Is there a way to display my custom SKU under each product on the WooCommerce order page?
The custom sku displays fine when I edit the product, but it does not display in the order page for the product. I need this information to show on the order so that Zapier can match it with the Visma Account Software ArticleID of the product.
This attempt is based on the solution How to add a (second) custom sku field to WooCommerce products?
// Add Custom SKU Field
function my_add_custom_sku() {
$args = array(
'label' => __( 'ArticleID', 'woocommerce' ),
'placeholder' => __( 'Enter Visma ArticleID Here', 'woocommerce' ),
'id' => 'articleid',
'desc_tip' => true,
'description' => __( 'Visma ArticleID is for integration with Zapier.', 'woocommerce' ),
);
woocommerce_wp_text_input( $args );
}
add_action( 'woocommerce_product_options_sku', 'my_add_custom_sku' );
// Save
function my_save_custom_meta( $product ){
if( isset($_POST['articleid']) ) {
$product->update_meta_data( 'articleid', sanitize_text_field( $_POST['articleid'] ) );
}
}
add_action( 'woocommerce_admin_process_product_object', 'my_save_custom_meta', 10, 1 );