Blog

Kalabasa

Replace WordPress Logo in Gutenberg Fullscreen Mode

First of all let me show you guys what WordPress logo do I mean. You can find it in the top left part of the screen.

Default WordPress logo in Gutenberg fullscreen mode

And here is what we are going to achieve in this tutorial:

How to change WordPress logo in Gutenberg editor fullscreen mode

As you may notice I used a custom photo of me but you may use an SVG icon if you want.

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.

Hide Payment Methods Based on Shipping Class in the Cart

As you probably know, shipping classes apply to every product individually.

What does it mean for us? It means that we have to loop through all the products in the cart in our code and check their shipping classes using either get_shipping_class() or get_shipping_class_id() methods.

WooCommerce product shipping classes
In this example I created a new shipping class “No PayPal” (in WooCommerce > Settings > Shipping > Shipping Classes), so if there are products in the cart with this shipping class we are going to deactivate PayPal payment gateway.

Also we have two options here – if any product in the cart has a specific shipping class or if all the products in the cart have the specific shipping class.

How to Find Shipping Class ID?

When I create conditions with shipping classes in my code I usually use get_shipping_class() method, so I can check against shipping classes slugs, example. Slugs can easily be found in WooCommerce > Settings > Shipping > Shipping Classes.

But what you have to use get_shipping_class_id() method? Where and how to get a specific shipping class ID then?

First of all – you can inspect the code in your browser and find it there. In order to do that – please open product edit page and find “Product data” metabox. Go to “Shipping” tab and inspect “Shipping class” dropdown element.

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.