Unverified

Name

Add a Custom Prefix to WooCommerce Order Numbers

About

This snippet adds a custom prefix 'ORDER-' to all WooCommerce order numbers, making it easy to customize and track your orders uniquely." If you need any further adjustments or additional snippets, feel free to ask!

Language

PHP

Rating

Voted: 1 by 1 user(s)

How to Setup Snippet

First, install and activate the Code Snippets plugin from your WordPress dashboard to use this snippet. Once activated, navigate to the Snippets section and click on "Add New." Enter a title like "Add Custom Prefix to WooCommerce Order Numbers" and paste the provided code into the code editor. After pasting the code, run the snippet everywhere, then save and activate it. Once activated, the custom prefix `'ORDER-'` will be added to all your WooCommerce order numbers automatically. Edit 'ORDER-' in the snippet as you like to use

Codevault

WPAccess

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: 6.4

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

Website/ Profile URL:

https://wpaccess.in/

Snippet Source:

https://wpaccess.in/

History

Last modified:

23/08/2024

Important Note

This snippet has the following status:

Unverified

This snippet has not been verified, use with caution and at your own risk. See details provided by author in sidebar and click below to find out more.

Add a Custom Prefix to WooCommerce Order Numbers

 
                    
1add_filter('woocommerce_order_number', 'WPAccess_order_number_prefix', 9999, 2);
2 
3function WPAccess_order_number_prefix($order_id, $order) {
4 return 'ORDER-' . $order_id;
5}

1

Related Snippets

Please see some snippets below related to this snippet..

WooCommerce

AI Verified

0

Change store notice dismiss button text

Added: 1 year ago

Last Updated: 1 year ago

Replace the word dismiss (on the WooCommerce store notice) with an x

WooCommerce

AI Verified

0

Redirect product category to page ID

Added: 1 year ago

Last Updated: 1 year ago

Redirect a product category to a page ID

WooCommerce

AI Verified

0

Remove the product description title

Added: 2 years ago

Last Updated: 1 year ago

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

General

Unverified

1

404 Redirection to Home page

Added: 3 weeks ago

Last Updated: 3 weeks ago

This snippet redirects all 404 errors to the homepage, providing a seamless user experience and preventing visitors from encountering dead ends

WooCommerce

Unverified

1

Add a Custom Prefix to WooCommerce Order Numbers

Added: 3 weeks ago

Last Updated: 3 weeks ago

This snippet adds a custom prefix 'ORDER-' to all WooCommerce order numbers, making it easy to customize and track your orders uniquely." If you need any further adjustments or additional snippets,...

WooCommerce

Unverified

1

Automatically Cancel WooCommerce Failed Orders Older Than One Week

Added: 3 weeks ago

Last Updated: 3 weeks ago

This snippet automatically cancels WooCommerce orders that have a 'failed' status for more than one week. The process is run daily to keep your order management clean and up-to-date.