/**
  * Create a Square Item for a WC Product
  *
  * @param WC_Product $wc_product
  * @param bool       $include_category
  * @param bool       $include_inventory
  *
  * @return object|bool Created Square Item object on success, boolean False on failure.
  */
 public function create_product(WC_Product $wc_product, $include_category = false, $include_inventory = false)
 {
     $square_item = $this->connect->create_square_product($wc_product, $include_category, $include_inventory);
     if ($square_item) {
         WC_Square_Utils::set_square_ids_on_wc_product_by_sku($wc_product, $square_item);
         return $square_item;
     }
     WC_Square_Sync_Logger::log(sprintf('[WC -> Square] Error creating Square Item for WC Product %d.', $wc_product->id));
     return false;
 }
 /**
  * Sync a Square Item to WC, optionally including Categories and Inventory.
  *
  * @param object $square_item
  * @param bool   $include_category
  * @param bool   $include_inventory
  * @param bool   $include_image
  */
 public function sync_product($square_item, $include_category = false, $include_inventory = false, $include_image = false)
 {
     $wc_product = WC_Square_Utils::get_wc_product_for_square_item($square_item);
     $is_new_product = false === $wc_product;
     // Only create items that don't yet exist in WC
     if ($is_new_product) {
         $wc_product = $this->create_product($square_item, $include_category, $include_inventory, $include_image);
         WC_Square_Sync_Logger::log(sprintf('[Square -> WC] Creating WC product for Square Item ID %s.', $square_item->id));
     }
     if ($wc_product) {
         WC_Square_Utils::set_square_ids_on_wc_product_by_sku($wc_product, $square_item);
         if ($include_inventory) {
             $this->sync_inventory($wc_product, $square_item);
             WC_Square_Sync_Logger::log(sprintf('[Square -> WC] Syncing WC product inventory for Square Item ID %s.', $square_item->id));
         }
         if (!$is_new_product) {
             $this->update_product($wc_product, $square_item, $include_category, $include_inventory, $include_image);
             WC_Square_Sync_Logger::log(sprintf('[Square -> WC] Updating WC product for Square Item ID %s.', $square_item->id));
         }
     } else {
         WC_Square_Sync_Logger::log(sprintf('[Square -> WC] Error creating WC Product found for Square Item ID %s.', $square_item->id));
         return;
     }
 }