Where is the “default attribute” values located in the phpMyAdmin in Woocommerce?

Default attributes of WooCommerce variable products are stored as post meta in the database. You can find them in the wp_postmeta table, where the post_id column is the post ID of the parent product (Variable product), and the meta_key column is _default_attributes. You can clear and remove default attributes of all products by replacing all … Read more

WooCommerce: add different order item meta for each item in order

Try, woocommerce_checkout_create_order_line_item It has 4 available arguments and available after version WooCommerce 3.3+. $item is an instance of WC_Order_Item_Product new introduced Class $cart_item_key is the cart item unique hash key $values is the cart item $order an instance of the WC_Order object (This is a very useful additional argument in some specific cases) In this … Read more

Detect whether a page is a product subcategory page?

is_category() only check the built in post category. Product categories are custom taxonomies. So you need to use is_tax() instead of is_category() and get_term() instead of get_category(). Check this example:- function is_subcategory($cat_id = null) { if (is_tax(‘product_cat’)) { if (empty($cat_id)){ $cat_id = get_queried_object_id(); } $cat = get_term(get_queried_object_id(), ‘product_cat’); if ( empty($cat->parent) ){ return false; }else{ … Read more

Limit users to one active subscription in WooCommerce Subscriptions? [closed]

Unless I’m misunderstanding you, WC Subscriptions already has this functionality. Firstly, set your subscription product to be variable or grouped, rather than having multiple individual products. Set the subscription product to limit purchasing: https://docs.woocommerce.com/document/subscriptions/store-manager-guide/#limit-subscription Then turn on allow switching: https://docs.woocommerce.com/document/subscriptions/switching-guide/#section-2 Hope that helps

Display orders instead of woocommerce my account dashboard for logged in users [closed]

How to redirect a user to my-account/orders correctly Try this: add_action( ‘parse_request’, ‘redirect_to_my_account_orders’ ); function redirect_to_my_account_orders( $wp ) { // All other endpoints such as change-password will redirect to // my-account/orders $allowed_endpoints = [ ‘orders’, ‘edit-account’, ‘customer-logout’ ]; if ( is_user_logged_in() && preg_match( ‘%^my\-account(?:/([^/]+)|)/?$%’, $wp->request, $m ) && ( empty( $m[1] ) || ! in_array( … Read more