Archives by year: 2021

2021 Year in Review

I know that it is already February but I decided that it would be a really good idea to do these annual recaps here, on my blog.

Payment Complete Hooks

There are three different WooCommerce hooks after payment completed I would like to talk about.

  • woocommerce_pre_payment_complete,
  • woocommerce_payment_complete,
  • woocommerce_payment_complete_order_status_$status;

All of those hooks are fired when an order is either paid or doesn’t require a payment (Cash on Delivery for example). They also apply for custom payment gateways.

Get Shipping Class ID or Slug

In this tutorial I would like to show you how you can either find both shipping class ID and slug in WordPress admin or get them programmatically using WC_Product object’s methods.

Redirect to a Different Thank You Page based on Payment Method

In this tutorial I will show how to perform a redirect to a custom order received paged depending on a payment gateway used by customer.

How to Configure Payment Gateways by User Roles

In this tutorial, I will show you how you can configure WooCommerce role-based payment methods. In other words, how you can enable or disable specific payment methods in your store depending on a user role, for example, to restrict the use of “Cash on delivery” for the “Subscriber” role or allow using some payment methods with a discounted price for “Premium customers”.

As usual, I will show you both plugin and programmatic approaches.

How to Add Custom Panels to Gutenberg Post Settings Sidebar

In this simple tutorial I will show you how to do this:

Add custom Gutenberg settings panels PluginDocumentSettingPanel
In this example we’ve added a custom panel “Custom post settings” with a heart icon from Dashicons set with random text.

Disable Payment Method for a Specific Product

In this tutorial, I will show you two things: how to disable a payment method on your WooCommerce store for a specific product, and then we will do it for a product category (or a product tag, or a product brand – the whole idea is the same).

We will do it using two approaches:

Let’s jump into it.