Enable ACF Theme Options Page

if (function_exists(‘acf_add_options_page’)) { acf_add_options_page(array( ‘page_title’ => ‘Theme General Settings’, ‘menu_title’ => ‘Theme Settings’, ‘menu_slug’ => ‘theme-general-settings’, ‘capability’ => ‘edit_posts’, ‘redirect’ => false )); }Continue reading

Hide Shipping Rates When Free Shipping is Available

function g9_hide_shipping_when_free_is_available($rates) { $free = array(); foreach ($rates as $rate_id => $rate) { if (‘free_shipping:1’ === $rate->id) { $free[$rate_id] = $rate; break; } } return !empty($free) ? $free : $rates; } add_filter(‘woocommerce_package_rates’, ‘g9_hide_shipping_when_free_is_available’, 100);Continue reading

Add New Product Badge

function g9_new_product_badge_shop_page() { global $product; $newness_days = 120; $created = strtotime($product->get_date_created()); if ((time() – (60 * 60 * 24 * $newness_days)) < $created) { echo '‘ . esc_html__(‘New!’, ‘woocommerce’) . ‘‘; } } add_action(‘woocommerce_before_shop_loop_item_title’, ‘g9_new_product_badge_shop_page’, 3);Continue reading

Display Related Products on 3 Columns

function g9_change_number_related_products($args) { $args[‘posts_per_page’] = 3; $args[‘columns’] = 3; return $args; } add_filter(‘woocommerce_output_related_products_args’, ‘g9_change_number_related_products’, 9999);Continue reading