Puddinq.com sharing knowledge

Get all shipping methods in WooCommerce for debugging purposes

WooCommerce cross- and up sells bi-directional update

If your would like one added (and removed) cross (or up) sell product in WooCommerce to automatically ad the ‘current’ product as an up- or cross sell to the connected code. The following code will inspire you:

Display WooCommerce search results in FacetWP page

To make the search results appear on your facet page, add a search facet to the page and then just add these to your functions.php: YOUR_FACET_SEARCH_WIDGET_NAME – with the name of your facet YOUR_RESULT_PAGE – with the slug of you facet page The same thing can be done for the normal WordPress search form

WooCommerce add attribute to multiple products (programmatically)

This snippets was used in winkel-centrum.nl, I needed to adjust an import and add colors found in the title as attributes. I had imported the products and wanted to extract a word from the title to add as attribute in the product. I used a shortcode because I wanted to visualize the products I was […]

WooCommerce Checkout require number if not 'local pickup'

In the Netherlands WooCommerce removed the second address line. This made the error rate for people failing to insert the housenumber rise. I had two options, put the second line back and make it rweuired, or check if the one line that is there has a number in it..

Programmatticaly create a WooCommerce product with variations

Sometimes you need to alter a lot of products, or create extra options. Even if bulk edit could do it and you max to editing 200 pages at once, it is still a tedious job vulnerable for human error. You need a script. The snippets below will not fix your job but give you the […]

Checkout: custom date field

In this situation we want a custom field on checkout which has a jQuery Date selector: /** * enqueue jquery datepicker script * * If is not admin (backend) and the page is * woocommerce checkout add the field */

Checkout: give a discount for local pickup

I had to add a discount for local pickup and at first this looked easy. You can set the costs to be a negative amount. But if the subtotal for the order was smaller then the discount, they got the order for free. So I wanted the discount only if the order subtotal was more […]