get_shipping_methods() return empty rate
I found answer my question $woocommerce->shipping()->calculate_shipping_for_package($package); $shipping_methods = $woocommerce->shipping()->get_shipping_methods(); It was fill rate And calculate the cost
I found answer my question $woocommerce->shipping()->calculate_shipping_for_package($package); $shipping_methods = $woocommerce->shipping()->get_shipping_methods(); It was fill rate And calculate the cost
You can use get_terms(): <?php $args = array( ‘taxonomy’ => ‘name-of-the-category’, ‘meta_query’ => array( array( ‘key’ => ‘ref’, ‘value’ => ‘53113’, ), ), ); $terms = get_terms( $args ); You would get an array of terms, where the ref value would be 53113.
Instead of a cpt for this, you can create a new product type with the wc api. You will have your new product type in the same product-edit admin page.
If you want to remove the images from folder, There is a two way to remove image 1) Remove by manually 2) Remove by using plugin. 1) Using Plugin I suggest you that can try the Image Cleanup plugin and it’s the best, but still good to make a backup first. There is an another … Read more
The brief description of a WooCommerce product is store as post_excerpt, to programmatically add some text, you need to hook through product excerpt. add_filter(‘get_the_excerpt’, ‘custom_excerpt’); function exc($custom_excerpt) { global $post; if($post->post_type == ‘product’){ $custom_add = __(‘This product is unavailable for some countries, please, read our terms & conditions to know more about this.’, ‘folkstone’); return … Read more
global $product; $attributes = $product->get_attribute( ‘pa_attribute_name’ );
I have a similar code that is working fine for me. Try putting your ids into an array like so: $cat_args[‘exclude’] = array(’12, 13′);
First you have to passed two additional arguments into the register_post_type() function. capability_type map_meta_cap Then, You can add capability using add_cap(); function. register_post_type( ‘acme_product’, array( ‘labels’ => array( ‘name’ => __( ‘Products’ ), ‘singular_name’ => __( ‘Product’ ) ), ‘public’ => true, ‘has_archive’ => true, ‘capability_type’ => array(‘acme_product’,’acme_products’), ‘map_meta_cap’ => true, ) ); add_action(‘admin_init’,’vendor_role_caps’); function … Read more
Found the issue.. somehow my serialized string was corrupt, when trying to edit the data in the WP Backend it threw an error and the data was reset. Unserialize now works fine and everything is OK. I don’t know if this could help anybody who might be in a similar situation therefore I am not … Read more
Assuming you can retrieve the order ID, you can do this $order = new WC_Order($order_id); $items = $order->get_items(); Then you can loop through results to add the product name to your array. foreach($items as $item){ $product_names .= $item[‘name’] .’ ‘; }