In WooCommerce I need to modify the thankyou.php page [closed]

I ended up inserting the payment description. (the one you specify in the woocommerce settings in the WordPress backend) The “native” build-in woocommerce payment-text is static and doesn’t relates to the actual selected payment method. 🙁 I did this by modifying the woocommerce template file: 1: Copy this template file: ..wp-content/plugins/woocommerce/templates/checkout/thankyou.php to your-theme-folder/woocommerce/checkout/thankyou.php 2: Replace … 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

Where do I find the functions triggered within a hook?

Looking at the current version of Storefront’s header.php: /** * Functions hooked into storefront_header action * * @hooked storefront_skip_links – 0 * @hooked storefront_social_icons – 10 * @hooked storefront_site_branding – 20 * @hooked storefront_secondary_navigation – 30 * @hooked storefront_product_search – 40 * @hooked storefront_primary_navigation_wrapper – 42 * @hooked storefront_primary_navigation – 50 * @hooked storefront_header_cart – … 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

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