Skip to content

Instantly share code, notes, and snippets.

Avatar Documentation woogist

View GitHub Profile
woogist / wc-eu-vat-remove-some-countries.php
Created Sep 29, 2021
filter to remove select countries where the VAT number field will show for
View wc-eu-vat-remove-some-countries.php
add_filter( 'woocommerce_eu_vat_number_country_codes', 'woo_custom_eu_vat_number_country_codes' );
function woo_custom_eu_vat_number_country_codes( $vat_countries ) {
$display_vat = array_diff($vat_countries, ['SE', 'GB']); // remove countries in second array
return array_values($display_vat); // reindex array
woogist / wc-eu-vat-one-country.php
Created Sep 29, 2021
filter the countries where the VAT number field will show for
View wc-eu-vat-one-country.php
add_filter( 'woocommerce_eu_vat_number_country_codes', 'woo_custom_eu_vat_number_country_codes' );
function woo_custom_eu_vat_number_country_codes( $vat_countries ) {
// only show field for users in BE
return array( 'BE' );
woogist / gist:b68ee2d83eb620b301ba44a365afe296
Created May 25, 2020
View gist:b68ee2d83eb620b301ba44a365afe296
add_filter( 'woocommerce_table_rate_compare_price_limits_after_discounts', '__return_true' );
woogist /
Last active May 22, 2020
WooCommerce Shipment Tracking REST API

Shipment Tracking REST API

The shipment tracking REST API allows you to create, view, and delete individual shipment tracking. The endpoint is /wp-json/wc-shipment-tracking/v3/.

Shipment Tracking Properties

Attribute Type Description
tracking_id string Unique identifier for shipment tracking read-only
tracking_number string Tracking number required
View change_default_provider.php
add_filter( 'woocommerce_shipment_tracking_default_provider', 'custom_woocommerce_shipment_tracking_default_provider' );
function custom_woocommerce_shipment_tracking_default_provider( $provider ) {
$provider = 'USPS';
return $provider;
View hide_unused_providers.php
add_filter( 'wc_shipment_tracking_get_providers', 'custom_shipment_tracking' );
function custom_shipment_tracking( $providers ) {
unset($providers['Czech Republic']);
woogist / change-products-per-page-storefront.php
Created Oct 11, 2017
Documentation: Storefront Filters example: Change the number of products displayed per page
View change-products-per-page-storefront.php
function alter_sf_products_per_page() {
// Return the number of products per page ( default: 12 ).
return 8;
add_filter('storefront_products_per_page', 'alter_sf_products_per_page' );
woogist / storefront-add-featured-product-text-example.php
Created Oct 11, 2017
Documentation: Storefront Actions example: Adding content below the featured product title
View storefront-add-featured-product-text-example.php
woogist / prevent_registered_learners_from_starting_courses.php
Created Feb 10, 2017
This code prevents Sensei learners from starting a course unless they've been specifically added to that course by a site administrator or a teacher.
View prevent_registered_learners_from_starting_courses.php
function sensei_display_start_course_form_when_admin_or_teacher( $should_display_start, $course_id ) {
global $current_user;
if ( empty( $current_user ) ) {
$current_user = wp_get_current_user();
if ( !( $current_user instanceof WP_User ) || 0 === $current_user->ID ) {
woogist / fue-template.html
Created Dec 2, 2016
Follow-up emails template name
View fue-template.html
<!-- Template Name: Unique name of your choosing -->