WooCommerce

  • WooCommerce

    Automatically apply a coupon to logged in users

    Force apply a permanent coupon to logged-in WooCommerce users to provide a client discount. One way to provide a discount to logged in users would be to dynamically modify the product prices, how ever this method doesn’t show as a discount in a WC Order. Here is a method that applies the discount as a…

    Read more

  • WooCommerce

    Dynamic checkout fields based on selected shipping method

    By default WooCommerce checkout includes fields for address, post code, city and state, how ever when using a shipping method such as “Local pickup” there is no need to collect client address information. Here’s some custom code that can be used to dynamically hide certain WC checkout fields based on which shipping method is selected.…

    Read more

  • WooCommerce

    WooCommerce discount for logged-in users

    An example of custom code that provides a discount for all logged-in users. The code should ideally be placed in a file in your child theme’s directory and you can then include it from your child theme’s functions.php.If you’re not using a child theme you can use mu-plugins instead. Let’s start off with a simple…

    Read more

  • WooCommerce

    Displaying WooCommerce products with shortcodes

    While WordPress has the block editor and various blocks for displaying WooCommerce products, shortcodes are still a popular method for displaying lists of WC products because unlike blocks they use consistent styling provided by the theme, instead of hard-coded styles that WC blocks use. Here is a reference of the most common shortcodes for displaying…

    Read more