How to filter Post using Meta Data REST API
How to filter Post using Meta Data REST API
How to filter Post using Meta Data REST API
How to get all products from an order including variations via SQL query?
I’ve recently came across this problem as well and managed to fix it. In my case I created the order and added the line items and coupons programatically. When this is done, you calculate the totals and taxes. If there was no coupon to apply I would use: $order->calculate_totals( true ) and when a coupon … Read more
WP WPQuery, not running properly in WP CLI
Its the woocommerce_get_shop_coupon_data filter, example code: add_filter ( ‘woocommerce_get_shop_coupon_data’, ‘mp_create_coupon’, 10, 2 ); function mp_create_coupon( $data, $code ) { // Check if the coupon has already been created in the database global $wpdb; $sql = $wpdb->prepare( “SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type=”shop_coupon” AND post_status=”publish” ORDER BY post_date DESC LIMIT 1;”, $code … Read more
get_terms() accept an array of arguments as second parameter. One of those parameters are include include (integer) An array of term ids to include. Empty returns all. You already have your selected term ids in an array, so just simply pass them to the include parameter in the array of arguments in get_terms() $terms = … Read more
To change the heading that appears in the body (message) of the email template you can use the following filter: ‘woocommerce_email_heading_’ . $this->id where $this->id equates to the id class property that is set within the email class of the specified type. For example, to change the heading of the “New Order” email you would … Read more
Ok I found out the solution. Because, as I said, WooCommerce has it’s own hooks, first of all I’ve searched for a WooCommerce hook about registration. I discovered the existence of a hook very similiar to the one used by WordPress: woocommerce_registration_errors. Obviously it works in the same way. Then I simply replaced the WordPress … Read more
Try this instead: add_action( “woocommerce_email_after_order_table”, “my_woocommerce_email_after_order_table”, 10, 1); function my_woocommerce_email_after_order_table( $order ) { $my_gift_wrap_checkbox = get_post_meta( $order->id, “my_gift_wrap_checkbox”, true ); $gift_wrap = $my_gift_wrap_checkbox ? ‘Yes please!’ : ‘No thank you.’; echo ‘<p><strong>Gift wrap?: </strong>’ . $gift_wrap . ‘</p>’; if ( $my_gift_wrap_checkbox ) { echo ‘<p><strong>Gift wrap instructions: </strong>’ . get_post_meta( $order->id, “my_gift_wrap_field”, true ) . … Read more
For all of those who will be struggling with this you just simply need to use this like: update_post_meta($attID1, ‘attribute_print_size’, ‘8×10’); update_post_meta($attID1, ‘attribute_paper_type’, ‘Premium Luster Photo’); This sets the exact variations.