Skip to content

Commit

Permalink
Merge pull request #2835 from vahidkay-meta/release/3.3.1
Browse files Browse the repository at this point in the history
Release 3.3.1
  • Loading branch information
vahidkay-meta authored Jan 10, 2025
2 parents 93ac576 + 194ea8b commit e416c2e
Show file tree
Hide file tree
Showing 5 changed files with 330 additions and 47 deletions.
4 changes: 2 additions & 2 deletions facebook-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Description: Grow your business on Facebook! Use this official plugin to help sell more of your products using Facebook. After completing the setup, you'll be ready to create ads that promote your products and you can also create a shop section on your Page where customers can browse your products on Facebook.
* Author: Facebook
* Author URI: https://www.facebook.com/
* Version: 3.3.0
* Version: 3.3.1
* Requires at least: 5.6
* Requires PHP: 7.4
* Text Domain: facebook-for-woocommerce
Expand Down Expand Up @@ -49,7 +49,7 @@ class WC_Facebook_Loader {
/**
* @var string the plugin version. This must be in the main plugin file to be automatically bumped by Woorelease.
*/
const PLUGIN_VERSION = '3.3.0'; // WRCS: DEFINED_VERSION.
const PLUGIN_VERSION = '3.3.1'; // WRCS: DEFINED_VERSION.

// Minimum PHP version required by this plugin.
const MINIMUM_PHP_VERSION = '7.4.0';
Expand Down
4 changes: 2 additions & 2 deletions includes/Admin/Settings_Screens/Advertise.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,13 @@ class="fb-lwi-ads-creation"
data-hide-manage-button="true"
data-fbe-extras="<?php echo esc_attr( $fbe_extras ); ?>"
data-fbe-scopes="manage_business_extension"
data-fbe-redirect-uri="https://mariner9.s3.amazonaws.com/"
data-fbe-redirect-uri="https://business.facebook.com/fbe-iframe-handler"
data-title="<?php esc_attr_e( 'If you are connected to Facebook but cannot display ads, please contact Facebook support.', 'facebook-for-woocommerce' ); ?>"></div>
<div
class="fb-lwi-ads-insights"
data-fbe-extras="<?php echo esc_attr( $fbe_extras ); ?>"
data-fbe-scopes="manage_business_extension"
data-fbe-redirect-uri="https://mariner9.s3.amazonaws.com/"></div>
data-fbe-redirect-uri="https://business.facebook.com/fbe-iframe-handler"></div>
<?php
$this->maybe_render_learn_more_link( __( 'Advertising', 'facebook-for-woocommerce' ) );

Expand Down
49 changes: 35 additions & 14 deletions includes/fbproduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

require_once __DIR__ . '/fbutils.php';

use WooCommerce\Facebook\Framework\Plugin\Compatibility;
use WooCommerce\Facebook\Framework\Helper;
use WooCommerce\Facebook\Products;

Expand Down Expand Up @@ -457,22 +458,31 @@ public function add_sale_price( $product_data, $for_items_batch = false ) {

$sale_price = $this->woo_product->get_sale_price();
$sale_price_effective_date = '';

$sale_start =
( $date = $this->woo_product->get_date_on_sale_from() )
? date_i18n( WC_DateTime::ATOM, $date->getOffsetTimestamp() )
: self::MIN_DATE_1 . self::MIN_TIME;

$sale_end =
( $date = $this->woo_product->get_date_on_sale_to() )
? date_i18n( WC_DateTime::ATOM, $date->getOffsetTimestamp() )
: self::MAX_DATE . self::MAX_TIME;
$sale_start = '';
$sale_end = '';

// check if sale exist
if ( is_numeric( $sale_price ) && $sale_price > 0 ) {
$sale_price_effective_date = $sale_start . '/' . $sale_end;
$sale_price =
$sale_start =
( $date = $this->woo_product->get_date_on_sale_from() )
? date_i18n( WC_DateTime::ATOM, $date->getOffsetTimestamp() )
: self::MIN_DATE_1 . self::MIN_TIME;
$sale_end =
( $date = $this->woo_product->get_date_on_sale_to() )
? date_i18n( WC_DateTime::ATOM, $date->getOffsetTimestamp() )
: self::MAX_DATE . self::MAX_TIME;
$sale_price_effective_date =
( $sale_start == self::MIN_DATE_1 . self::MIN_TIME && $sale_end == self::MAX_DATE . self::MAX_TIME )
? ''
: $sale_start . '/' . $sale_end;
$sale_price =
intval( round( $this->get_price_plus_tax( $sale_price ) * 100 ) );

// Set Sale start and end as empty if set to default values
if ( $sale_start == self::MIN_DATE_1 . self::MIN_TIME && $sale_end == self::MAX_DATE . self::MAX_TIME ) {
$sale_start = '';
$sale_end = '';
}
}

// check if sale is expired and sale time range is valid
Expand Down Expand Up @@ -715,9 +725,20 @@ public function prepare_product( $retailer_id = null, $type_to_prepare_for = sel
$product_data = $this->apply_enhanced_catalog_fields_from_attributes( $product_data, $google_product_category );
}

// add the Commerce values (only stock quantity for the moment)
if ( Products::is_product_ready_for_commerce( $this->woo_product ) ) {
// Add stock quantity if the product or variant is stock managed.
// In case if variant is not stock managed but parent is, fallback on parent value.
if ( $this->woo_product->managing_stock() ) {
$product_data['quantity_to_sell_on_facebook'] = (int) max( 0, $this->woo_product->get_stock_quantity() );
} else if ( $this->woo_product->is_type( 'variation' ) ) {
$parent_product = wc_get_product( $this->woo_product->get_parent_id() );
if ( $parent_product && $parent_product->managing_stock() ) {
$product_data['quantity_to_sell_on_facebook'] = (int) max( 0, $parent_product->get_stock_quantity() );
}
}

// Add GTIN (Global Trade Item Number)
if ( Compatibility::is_wc_version_gte( '9.1.0' ) && $gtin = $this->woo_product->get_global_unique_id() ) {
$product_data['gtin'] = $gtin;
}

// Only use checkout URLs if they exist.
Expand Down
63 changes: 34 additions & 29 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Contributors: facebook, automattic, woothemes
Tags: facebook, woocommerce, marketing, product catalog feed, pixel
Requires at least: 5.6
Tested up to: 6.7
Stable tag: 3.3.0
Tested up to: 6.7
Stable tag: 3.3.0
Requires PHP: 7.4
MySQL: 5.6 or greater
License: GPLv2 or later
Expand Down Expand Up @@ -40,33 +40,38 @@ When opening a bug on GitHub, please give us as many details as possible.

== Changelog ==

= 3.3.0 - 2024-11-07 =
* Add - Extension navigation tabs on Product Sets screens.
* Tweak - Tooltips, config labels, documentation links.
* Tweak - WC 9.4 compatibility.
* Tweak - WP 6.7 compatibility.

= 3.2.10 - 2024-09-30 =
* Update - Remove Marketing Products Sets menu entry.

= 3.2.9 - 2024-09-12 =
* Break - Removes WooCommerce navigation items.
* Tweak - WC 9.3 compatibility.

= 3.2.8 - 2024-09-03 =
* Update - Access Token retrieval procedure.
* Update - Use get_title() for content_name to match catalog name.

= 3.2.7 - 2024-08-13 =
* Dev - Updated `phpcs` ruleset.
* Fix - Update failing due to undefined constant error in Lifecycle.
* Tweak - WC 9.2 compatibility.

= 3.2.6 - 2024-07-23 =
* Add - Filter facebook_for_woocommerce_fb_product_description.
* Fix - Remove deprecated FILTER_SANITIZE_STRING usage.
* Tweak - Align PHP require version to composer.json.

= 3.3.1 - 2024-12-06 =
Fix - Sale price effective date by @vinkmeta in #2809
Fix - Sync stock quantity when available by @mshymon in #2811
Fix - Sync product GTIN when available by @mshymon in #2810

= 3.3.0 - 2024-11-07 =
* Add - Extension navigation tabs on Product Sets screens.
* Tweak - Tooltips, config labels, documentation links.
* Tweak - WC 9.4 compatibility.
* Tweak - WP 6.7 compatibility.

= 3.2.10 - 2024-09-30 =
* Update - Remove Marketing Products Sets menu entry.

= 3.2.9 - 2024-09-12 =
* Break - Removes WooCommerce navigation items.
* Tweak - WC 9.3 compatibility.

= 3.2.8 - 2024-09-03 =
* Update - Access Token retrieval procedure.
* Update - Use get_title() for content_name to match catalog name.

= 3.2.7 - 2024-08-13 =
* Dev - Updated `phpcs` ruleset.
* Fix - Update failing due to undefined constant error in Lifecycle.
* Tweak - WC 9.2 compatibility.

= 3.2.6 - 2024-07-23 =
* Add - Filter facebook_for_woocommerce_fb_product_description.
* Fix - Remove deprecated FILTER_SANITIZE_STRING usage.
* Tweak - Align PHP require version to composer.json.

= 3.2.5 - 2024-07-10 =
* Tweak - WC 9.1 compatibility.
* Tweak - WP 6.6 compatibility.
Expand Down
Loading

0 comments on commit e416c2e

Please sign in to comment.