Snippets for Classic Commerce

I have set up an area on the Classic Commerce website to start listing useful code snippets for Classic Commerce.

These are small pieces of code that add minor functionality without the need for extra plugins. They can be used in either the functions.php file in a child theme, or in a utility plugin that you have created specifically for that purpose.

The idea is similar to the one currently available on the WooCommerce docs…

If you have a code snippet that you find useful in CC/WC then post it here and I will add it. Please include a sentence or two about what the snippet does and why it is useful.


This is fantastic!
The official site is very good, looked it over last night. Also, took Classic Commerce for a test spin on a staging site - very fast and very impressed!

I do indeed have useful code snippets for WooCommerce. I will pass them on and you can adapt them for CP and CC functionality.

Keep up the good work! :clap:

( Just sent you a message of the WC snippets we use, so you can choose and share. )



Hey, thanks Avrom. I’m still tweaking the site but I think it’s getting closer. And great to hear that CC is working well for you.

Thanks also for those code snippets. I’ll go through them and add some to the site.


Your snippet to add the prefix to the $ sign is brilliant (US$, AU$, CA$, etc). I’m surprised that doesn’t come as a fundamental part of WC/CC. Seems like an obvious requirement for any shop selling to multiple countries.

Might be worth adding that as an enhancement request in GitHub.

(also like the redirect shop page one… that’s useful)


Hi Alan,
I’d like to take credit for the currency code, but it was taken from the web. I found lots of developers using that same code snippet. So why write it from scratch?
The only issue I have with it, is it places the currency prefix everywhere. It would be nicer if it was just for subtotals and totals.

The reason it isn’t added to WooCommerce by default, is they can’t up-sell plugins. :wink:


1 Like

Hey, that’s the same place I get all my code. :wink: