Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions includes/Handlers/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ public static function update_stock_from_square( \WC_Product $product, $save = t
}

$inventory_tracking_data = $inventory_tracking[ $square_id ] ?? array();
$is_inventory_tracking = $inventory_tracking_data['track_inventory'] ?? true;
$is_inventory_tracking = $inventory_tracking_data['track_inventory'] ?? false;
$sold_out = $inventory_tracking_data['sold_out'] ?? false;

if ( $is_inventory_tracking ) {
Expand Down Expand Up @@ -499,7 +499,7 @@ public static function update_products_stock_from_square( $product_ids ) {
$square_id = $catalog_object->getId();
$stock = $inventory_hash[ $square_id ] ?? 0;
$inventory_tracking_data = $inventory_tracking[ $square_id ] ?? array();
$is_inventory_tracking = $inventory_tracking_data['track_inventory'] ?? true;
$is_inventory_tracking = $inventory_tracking_data['track_inventory'] ?? false;
$sold_out = $inventory_tracking_data['sold_out'] ?? false;

$product_id = $products_map[ $square_id ]['product_id'];
Expand Down
6 changes: 3 additions & 3 deletions includes/Sync/Interval_Polling.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ protected function update_inventory_tracking() {
$catalog_objects_to_update = array();

foreach ( $catalog_objects_tracking_stats as $catalog_object_id => $inventory_data ) {
$is_tracking_inventory = $inventory_data['track_inventory'] ?? true;
$is_tracking_inventory = $inventory_data['track_inventory'] ?? false;
$sold_out = $inventory_data['sold_out'] ?? false;
$product = Product::get_product_by_square_variation_id( $catalog_object_id );
if ( $product instanceof \WC_Product ) {
Expand All @@ -317,7 +317,7 @@ protected function update_inventory_tracking() {
$product = Product::get_product_by_square_variation_id( $catalog_object_id );
if ( $product instanceof \WC_Product ) {
$inventory_data = $catalog_objects_tracking_stats[ $catalog_object_id ] ?? array();
$is_tracking_inventory = $inventory_data['track_inventory'] ?? true;
$is_tracking_inventory = $inventory_data['track_inventory'] ?? false;
$sold_out = $inventory_data['sold_out'] ?? false;

/* If catalog object is tracked and has a quantity > 0 set in Square. */
Expand Down Expand Up @@ -421,7 +421,7 @@ protected function update_inventory_counts() {
// Square can return multiple "types" of counts, WooCommerce only distinguishes whether a product is in stock or not
if ( $product instanceof \WC_Product ) {
$inventory_data = $catalog_objects_tracking_stats[ $catalog_object_id ] ?? array();
$is_tracking_inventory = $inventory_data['track_inventory'] ?? true;
$is_tracking_inventory = $inventory_data['track_inventory'] ?? false;
$sold_out = $inventory_data['sold_out'] ?? false;

if ( $is_tracking_inventory ) {
Expand Down
2 changes: 1 addition & 1 deletion includes/Sync/Manual_Synchronization.php
Original file line number Diff line number Diff line change
Expand Up @@ -1569,7 +1569,7 @@
$catalog_objects_tracking_stats = Helper::get_catalog_objects_tracking_stats( $catalog_object_ids );

foreach ( $catalog_objects_tracking_stats as $catalog_object_id => $inventory_data ) {
$is_tracking_inventory = $inventory_data['track_inventory'] ?? true;
$is_tracking_inventory = $inventory_data['track_inventory'] ?? false;
$sold_out = $inventory_data['sold_out'] ?? false;

if ( in_array( $catalog_object_id, $in_progress['processed_variation_ids'], false ) ) { // phpcs:disable WordPress.PHP.StrictInArray.FoundNonStrictFalse
Expand Down Expand Up @@ -1782,7 +1782,7 @@
*
* $param int $max
*/
return max( 1, (int) apply_filters( 'wc_square_sync_max_objects_to_retrieve', $max ) );

Check failure on line 1785 in includes/Sync/Manual_Synchronization.php

View workflow job for this annotation

GitHub Actions / test

WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound

Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: "wc_square_sync_max_objects_to_retrieve".
}


Expand All @@ -1807,7 +1807,7 @@
*
* $param int $max
*/
return max( 10, (int) apply_filters( 'wc_square_sync_max_objects_per_batch', $max ) );

Check failure on line 1810 in includes/Sync/Manual_Synchronization.php

View workflow job for this annotation

GitHub Actions / test

WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound

Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: "wc_square_sync_max_objects_per_batch".
}


Expand All @@ -1829,7 +1829,7 @@
*
* $param int $max
*/
return max( 1, (int) apply_filters( 'wc_square_sync_max_objects_per_upsert', $max ) );

Check failure on line 1832 in includes/Sync/Manual_Synchronization.php

View workflow job for this annotation

GitHub Actions / test

WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound

Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: "wc_square_sync_max_objects_per_upsert".
}


Expand All @@ -1851,6 +1851,6 @@
*
* $param int $max
*/
return max( 1, (int) apply_filters( 'wc_square_sync_max_objects_total', $max ) );

Check failure on line 1854 in includes/Sync/Manual_Synchronization.php

View workflow job for this annotation

GitHub Actions / test

WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound

Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: "wc_square_sync_max_objects_total".
}
}
2 changes: 1 addition & 1 deletion includes/Sync/Product_Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
*
* @param int limit
*/
$limit = (int) apply_filters( 'wc_square_import_api_limit', 100 );

Check failure on line 78 in includes/Sync/Product_Import.php

View workflow job for this annotation

GitHub Actions / test

WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound

Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: "wc_square_import_api_limit".

return max( 1, min( 1000, $limit ) );
}
Expand Down Expand Up @@ -318,7 +318,7 @@

if ( $product && $product instanceof \WC_Product ) {
$inventory_data = $catalog_objects_hash[ $catalog_object->getId() ] ?? array();
$is_tracking_inventory = $inventory_data['track_inventory'] ?? true;
$is_tracking_inventory = $inventory_data['track_inventory'] ?? false;
$sold_out = $inventory_data['sold_out'] ?? false;

/* If catalog object is tracked and has a quantity > 0 set in Square. */
Expand Down Expand Up @@ -580,7 +580,7 @@
* and keep existing name.
* @since 3.3.0
*/
$product_name = apply_filters( 'wc_square_update_product_set_name', $product_name, $catalog_object, $product );

Check failure on line 583 in includes/Sync/Product_Import.php

View workflow job for this annotation

GitHub Actions / test

WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound

Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: "wc_square_update_product_set_name".

/**
* Allow overriding product description during import from Square
Expand All @@ -595,7 +595,7 @@
* and keep existing description.
* @since 3.3.0
*/
$product_description = apply_filters( 'wc_square_update_product_set_description', $product_description, $catalog_object, $product );

Check failure on line 598 in includes/Sync/Product_Import.php

View workflow job for this annotation

GitHub Actions / test

WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound

Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: "wc_square_update_product_set_description".
}

$data = array(
Expand Down
Loading