WordPress/Woocommerce: How To Get The Original Url Before It’s Rewritten

WordPress has it’s own rewrite API which it uses to prettify URLs, to give a specific WooCommerce example the shop URL http://wooexp.local/shop/ can be rewritten as http://wooexp.local/index.php?post_type=product If you type the URL above into a browser (changing the host from the I’m using on a Local by Flywheel test site to your site) then you … Read more

Using is_single() in WooCommerce

If you’ve ever done any coding in WordPress then you may have used the is_single() function, it’s super useful for finding out if you’re on a specific single post page function hwn_filter_content_using_issingle($content) { if( is_single(35) && is_main_query() ) { $new_content = ‘<p>This bonus content is added to the bottom of post 35.</p>’; $content .= $new_content; … Read more

How to use add_filter and apply_filters in WooCommerce

How to use add_filter and apply_filters in WooCommerce

Filters in WordPress allow you to alter content without directly altering core WordPress files, they also allow you to alter dynamically generated content before it is shown to users. As WooCommerce is built on top of WordPress filters are used extensively, and if you want to learn how to modify WooCommerce you’ll need to build … Read more

Setting up a Woocommerce Development Environment with Local by Flywheel and Visual Studio Code

In this article, we’re going to take a look at how to set-up a development environment for Woocommerce, by the time we’ve finished we should have an environment that will allow us to – Quickly spin up a fresh Woocommerce site that includes test data Edit code productively using an IDE Step through code using a debugger … Read more

How to remove “Sticky Add-To-Cart” and “Product Pagination” from the Storefront Woocommerce Theme

What are “Sticky Add-To-Cart” and “Product Pagination”? Hmmm, they’re not all that easy to describe. If you go to the single product page in the Storefront child theme you’ll see some floating images towards the far right and left of the screen, they look like this. If you hover over one of the images then … Read more

do_action and add_action in Woocommerce and WordPress

It’s quite hard to give an easy to understand definition of what do_action and add_action do, so I’m just going to launch straight into some code and hopefully, the purpose of the two methods will become clear reasonably quickly. Here’s a very simple example of do_action do_action(“display_some_numbers”); If we add the code above to a … Read more