Detect Product Type with code

The is_virtual() method in WC_Product class it return boolean. It means that, if $product->is_virtual() return true, it is virtual product, vice versa if return false, then the product is physical. In your case, you can use this if( $product->is_virtual() ) { //is Virtual Product, do something here } if( !$product->is_virtual() ) { //is Physical Product, … Read more

How do I add multiple custom menu Woo-commerce my account page?

function pa_custom_endpoint_keys() { global $wpdb; $charset_collate = $wpdb->get_charset_collate(); $phantom_option = $wpdb->prefix . ‘phantom_option’; $phantom_menu = $wpdb->prefix . ‘phantom_menu’; $results=$wpdb->get_results(“select * from $phantom_menu”); $endpointsdata =array(); foreach($results as $row){ $endpointsdata[$row->pa_menu_endpoint] = $row->pa_menu_name; } return $endpointsdata; } add_action( ‘init’, ‘pa_custom_endpoint’ ); function pa_custom_endpoint() { foreach(pa_custom_endpoint_keys() as $endpointkey=>$endpointlable){ add_rewrite_endpoint( $endpointkey, EP_ROOT | EP_PAGES ); flush_rewrite_rules(false); update_option(‘pa_permalinks_flushed’, 1); } } … Read more

I want to Display custom woocomerce meta box in orders list

Solved it here is the answer add_action( ‘manage_shop_order_posts_custom_column’, ‘delivery_company_order_column_content’, 10, 2 ); function delivery_company_order_column_content( $column, $post_id ) { if ( $column === ‘delivery_company_order’ ) { $order = wc_get_order( $post_id ); $delivery_company = get_post_meta( $order->get_id(), ‘delivery_company’, true ); $delivery_company_name = get_the_title( $delivery_company ); echo $delivery_company_name; } } add_filter(‘manage_edit-shop_order_columns’, ‘delivery_company_order_column’); function delivery_company_order_column($columns) { $columns[‘delivery_company_order’] = ‘Delivery Company’; … Read more