How to Show Single Product – 4 Data by ID in Custom Page without over-riding the existing Woo-Commerce

Your query returns an array of posts (query all products belonging to specific cat product cat), in your case it looks like there’s ony one. To display a list on your custom page you’ve to iterate the array with: $args = array( ‘post_type’ => ‘product’, ‘product_cat’ => ‘category-id’ );//note that this looks like a mistake, … Read more

WordPress select field – show current value?

By referencing to the source code, this function supports an argument called value which you can pass one of the keys inside the options array like this: function woo_add_spin() { woocommerce_wp_select([ ‘id’ => ‘_select_nf’, ‘label’ => __( ‘Select #spins: ‘, ‘woocommerce’ ), ‘selected’ => true, ‘value’ => ’24’, ‘options’ => [ ’24’ => __( ’24’, … Read more

Add custom order meta to Order Completed email

paste the below code your active theme functions.php file add_filter( ‘woocommerce_email_order_meta_fields’,’custom_order_email_order_meta_data’, 10, 3 ); function custom_order_email_order_meta_data( $fields, $sent_to_admin, $order ) { $fields[‘wpcf-purchase-student’] = array( ‘label’ => __( ‘purchase amount’, ‘woocommerce’ ), ‘value’ => get_post_meta( $order->id, ‘wpcf-purchase-student’, true ) ); return $fields; }