Add Attribute to Woocommerce programatically, doesn’t display front end [closed]

According to The Codex on wp_set_object_terms() get set by passing in a slug instead of the actual Term Name: wp_set_object_terms( $object_id, $terms, $taxonomy, $append ); $terms (array/int/string) (required) The slug or id of the term (such as category or tag IDs), will replace all existing related terms in this taxonomy. To clear or remove all … Read more

WooCommerce print subcategory of product

Configure, product_id and parent_category_id according to your requirements. /* This is product id */ $product_id = 1; /* This is the id of the parent category */ $parent_category_id = 8; $cats = get_categories ( array ( ‘type’ => ‘product’, ‘parent’ => $parent_category_id, ‘orderby’ => ‘term_group’, ‘hide_empty’ => true, ‘hierarchical’ = > 1, ‘exclude’ => ”, … Read more

Create a regular post for every WooCommerce order

in comments I propose to make the order as public but I found a easier way to display a order : with a shortcode i try this in a plugin : add_shortcode(“view_order”, function ($atts, $content = “”, $tag) { if (!isset($_GET[“order_id”])) { return “no id”; } $order = get_post($_GET[“order_id”]); if ( !isset($order) || (“shop_order” !== … Read more

Disable woocommerce PLACE ORDER button if user selected products that are not available for international delivery

Since I do not have a great answer for you after checking logic above (seems okay).. something else I noticed. add_action(‘woocommerce_update_order_review’ … Are you using the most recent update? I see no reference here docs.woothemes.com/wc-apidocs/hook-docs.html or on github depo for that do_action. Here is the current layout for hooks/filters on form-checkout.php.. Are you sure you … Read more

Woocommerce: Any way to list all products *without* a specific attribute?

I’ve had to do something similar recently, create a list of all attributes by product and product variation. I used SQL to produce the list. It’s a bit basic and I’m sure could be improved easily. SELECT wp_posts.id,wp_woocommerce_attribute_taxonomies.attribute_id, wp_woocommerce_attribute_taxonomies.attribute_name,wp_woocommerce_attribute_taxonomies.attribute_label, wp_posts.post_type, wp_posts.post_title FROM wp_woocommerce_attribute_taxonomies,wp_posts WHERE wp_posts.post_type=”product_variation” OR wp_posts.post_type=”product” I hope that helps, or points you in … Read more