diff --git a/includes/Handlers/Product/Woo_SOR.php b/includes/Handlers/Product/Woo_SOR.php index 87e4896b..22e2d467 100644 --- a/includes/Handlers/Product/Woo_SOR.php +++ b/includes/Handlers/Product/Woo_SOR.php @@ -84,7 +84,7 @@ public static function update_catalog_item( CatalogObject $catalog_object, \WC_P $attributes = $product->get_attributes(); $product_variation_ids = $product->get_children(); - $catalog_variations = $item_data->getVariations() ?: array(); + $catalog_variations = $item_data->getVariations() ? $item_data->getVariations() : array(); // if dealing with a variable product, try and match the variations if ( $product->is_type( 'variable' ) ) { @@ -110,7 +110,7 @@ public static function update_catalog_item( CatalogObject $catalog_object, \WC_P // Check if its a taxonomy-based attribute. $attribute_option_values = array(); if ( taxonomy_exists( $attribute_id ) ) { - $terms = get_terms( $attribute_id, array( 'hide_empty' => false ) ); + $terms = get_terms( $attribute_id ); $attribute_option_values = wp_list_pluck( $terms, 'name' ); } else { $attribute_option_values = $attribute->get_options(); @@ -139,9 +139,9 @@ public static function update_catalog_item( CatalogObject $catalog_object, \WC_P $product_options = array(); foreach ( $options_ids as $option_id ) { - $CatalogItemOptionForItem = new \Square\Models\CatalogItemOptionForItem(); - $CatalogItemOptionForItem->setItemOptionId( $option_id ); - $product_options[] = $CatalogItemOptionForItem; + $item_option = new \Square\Models\CatalogItemOptionForItem(); + $item_option->setItemOptionId( $option_id ); + $product_options[] = $item_option; } $catalog_object->getItemData()->setItemOptions( $product_options ); @@ -345,16 +345,16 @@ public static function update_catalog_variation( CatalogObject $catalog_object, } if ( $option_id && $option_value_id ) { - $CatalogItemOptionValueForItemVariation = new \Square\Models\CatalogItemOptionValueForItemVariation(); - $CatalogItemOptionValueForItemVariation->setItemOptionId( $option_id ); - $CatalogItemOptionValueForItemVariation->setItemOptionValueId( $option_value_id ); + $option_value_object = new \Square\Models\CatalogItemOptionValueForItemVariation(); + $option_value_object->setItemOptionId( $option_id ); + $option_value_object->setItemOptionValueId( $option_value_id ); - $variation_item_values[] = $CatalogItemOptionValueForItemVariation; + $variation_item_values[] = $option_value_object; } else { if ( $taxonomy_exists ) { // Get all attribute terms from Woo taxonomy. - $attribute_option_values = get_terms( $attribute_id, array( 'hide_empty' => false ) ); + $attribute_option_values = get_terms( $attribute_id ); $attribute_option_values = wp_list_pluck( $attribute_option_values, 'name' ); } else { // Get all attribute values from the parent product. @@ -375,11 +375,11 @@ public static function update_catalog_variation( CatalogObject $catalog_object, } } - $CatalogItemOptionValueForItemVariation = new \Square\Models\CatalogItemOptionValueForItemVariation(); - $CatalogItemOptionValueForItemVariation->setItemOptionId( $option_id ); - $CatalogItemOptionValueForItemVariation->setItemOptionValueId( $option_value_id ); + $option_value_object = new \Square\Models\CatalogItemOptionValueForItemVariation(); + $option_value_object->setItemOptionId( $option_id ); + $option_value_object->setItemOptionValueId( $option_value_id ); - $variation_item_values[] = $CatalogItemOptionValueForItemVariation; + $variation_item_values[] = $option_value_object; } }