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

How do I display certain products via their category on a section of a page using PHP?

you can still use a shortcode inside of php if you aren’t customizing the output. see https://docs.woocommerce.com/document/woocommerce-shortcodes/#scenario-5-specific-categories and https://developer.wordpress.org/reference/functions/do_shortcode/ <?php echo do_shortcode(‘[products category=”new-arrivals”]’); ?> Alternatively, If you need to customize the output of the products then just use wc_get_products to get a list of products and iterate through it. See https://github.com/woocommerce/woocommerce/wiki/wc_get_products-and-WC_Product_Query <?php $args = array( … Read more

How to get rid of the hover zoom in WooCommerce single products

This is possible using woocommerce_single_product_zoom_enabled dedicated filter hook: add_filter( ‘woocommerce_single_product_zoom_enabled’, ‘__return_false’ ); Code goes in functions.php file of your active child theme (or active theme). Tested and work. It is possible using woocommerce_single_product_zoom_enabled dedicated filter hook. The hook undocumented available parameters in the options array are: $zoom_options = array ( ‘url’ => false, ‘callback’ => … Read more

Process checkout using WC REST API

To process payment for an WooCommerce Order, the workflow goes like the following: Create an WooCommerce Order Process Payment for this order, using one of WC_Payment_Gateways Change order status (default is pending->processing, or to complete if empty order) IMHO, Step two can be implemented as the following: Use a front-end lib to tokenize payment info, … Read more

WooCommerce – Hook after Loading Variation in Admin Edit page?

In woocommerce/includes/class-wc-ajax.php there is a method on the WC_AJAX class responsible for loading variations called load_variations, it contains only one hook, which is a filter, named woocommerce_ajax_admin_get_variations_args which fires early in the method. However if you are looking for something client side, then woocommerce/assets/js/admin/meta-boxes-product-variation.js triggers an event on the success callback of the load_variations function … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)