__( 'WSE ACS Sync for WooCommerce', 'weship-acs-sync-for-woocommerce' ), 'target' => 'weship_acs_sync_product_data', 'class' => array(), 'priority' => 80, ); return $tabs; } /** * Render the Product Data tab panel. */ public function render_panel() { global $post; $product_id = $post->ID; ?>

self::META_PRODUCT_TYPE, 'label' => __( 'Product Type', 'weship-acs-sync-for-woocommerce' ), 'desc_tip' => true, 'description' => __( 'Sent as orderItems[].productType in the 800 Program order feed.', 'weship-acs-sync-for-woocommerce' ), 'value' => get_post_meta( $product_id, self::META_PRODUCT_TYPE, true ), ) ); woocommerce_wp_text_input( array( 'id' => self::META_CCP_PRODUCT_TYPE, 'label' => __( 'CCP Product Type', 'weship-acs-sync-for-woocommerce' ), 'desc_tip' => true, 'description' => __( 'Sent as orderItems[].ccpProductType in the 800 Program order feed.', 'weship-acs-sync-for-woocommerce' ), 'value' => get_post_meta( $product_id, self::META_CCP_PRODUCT_TYPE, true ), ) ); woocommerce_wp_text_input( array( 'id' => self::META_PCT_ALCOHOL, 'label' => __( 'Alcohol %', 'weship-acs-sync-for-woocommerce' ), 'desc_tip' => true, 'description' => __( 'Alcohol by volume, e.g. 13.5. Sent as orderItems[].pctAlcohol.', 'weship-acs-sync-for-woocommerce' ), 'value' => get_post_meta( $product_id, self::META_PCT_ALCOHOL, true ), 'type' => 'number', 'custom_attributes' => array( 'step' => '0.1', 'min' => '0', ), ) ); woocommerce_wp_text_input( array( 'id' => self::META_BOTTLE_SIZE, 'label' => __( 'Bottle Size', 'weship-acs-sync-for-woocommerce' ), 'desc_tip' => true, 'description' => __( 'E.g. 750ml. Sent as orderItems[].bottleSize.', 'weship-acs-sync-for-woocommerce' ), 'value' => get_post_meta( $product_id, self::META_BOTTLE_SIZE, true ), ) ); ?>
ID; ?>

'weship_acs_sync_product_type_' . $loop, 'name' => "weship_acs_sync_product_type[{$loop}]", 'label' => __( 'Product Type', 'weship-acs-sync-for-woocommerce' ), 'wrapper_class' => 'form-row form-row-first', 'value' => get_post_meta( $variation_id, self::META_PRODUCT_TYPE, true ), ) ); woocommerce_wp_text_input( array( 'id' => 'weship_acs_sync_ccp_product_type_' . $loop, 'name' => "weship_acs_sync_ccp_product_type[{$loop}]", 'label' => __( 'CCP Product Type', 'weship-acs-sync-for-woocommerce' ), 'wrapper_class' => 'form-row form-row-last', 'value' => get_post_meta( $variation_id, self::META_CCP_PRODUCT_TYPE, true ), ) ); woocommerce_wp_text_input( array( 'id' => 'weship_acs_sync_pct_alcohol_' . $loop, 'name' => "weship_acs_sync_pct_alcohol[{$loop}]", 'label' => __( 'Alcohol %', 'weship-acs-sync-for-woocommerce' ), 'wrapper_class' => 'form-row form-row-first', 'type' => 'number', 'custom_attributes' => array( 'step' => '0.1', 'min' => '0', ), 'value' => get_post_meta( $variation_id, self::META_PCT_ALCOHOL, true ), ) ); woocommerce_wp_text_input( array( 'id' => 'weship_acs_sync_bottle_size_' . $loop, 'name' => "weship_acs_sync_bottle_size[{$loop}]", 'label' => __( 'Bottle Size', 'weship-acs-sync-for-woocommerce' ), 'wrapper_class' => 'form-row form-row-last', 'value' => get_post_meta( $variation_id, self::META_BOTTLE_SIZE, true ), ) ); } /** * Save the per-variation fields. * * @param int $variation_id Variation ID. * @param int $loop Variation loop index. */ public function save_variation_fields( $variation_id, $loop ) { $fields = array( 'weship_acs_sync_product_type' => self::META_PRODUCT_TYPE, 'weship_acs_sync_ccp_product_type' => self::META_CCP_PRODUCT_TYPE, 'weship_acs_sync_pct_alcohol' => self::META_PCT_ALCOHOL, 'weship_acs_sync_bottle_size' => self::META_BOTTLE_SIZE, ); foreach ( $fields as $field_name => $meta_key ) { if ( isset( $_POST[ $field_name ][ $loop ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- covered by the product edit screen's own nonce. update_post_meta( $variation_id, $meta_key, sanitize_text_field( wp_unslash( $_POST[ $field_name ][ $loop ] ) ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing } } } }