Skip to content

Instantly share code, notes, and snippets.

View shameemreza's full-sized avatar
🇧🇩
Problem-Solver | WooCommerce Expert | Customer-First Mindset

Shameem Reza shameemreza

🇧🇩
Problem-Solver | WooCommerce Expert | Customer-First Mindset
View GitHub Profile
@shameemreza
shameemreza / change-the-currency-symbol-in-woocommerce.php
Created July 7, 2024 14:51
Change the currency symbol in WooCommerce
function filter_woocommerce_currency_symbol( $currency_symbol, $currency ) {
// Compare
switch( $currency ) {
case 'GBP': $currency_symbol = '€';
break;
}
return $currency_symbol;
}
add_filter( 'woocommerce_currency_symbol', 'filter_woocommerce_currency_symbol', 1, 2 );
@shameemreza
shameemreza / disable-default-shipping-method-selected.php
Created July 7, 2024 14:50
Disable default shipping method selected in WooCommerce
add_filter( 'woocommerce_shipping_chosen_method', '__return_false', 99);
@shameemreza
shameemreza / automatically-set-the-focus-keyword-with-product-title-in-rank-math-seo.php
Created July 7, 2024 14:49
Automatically set the focus keyword with product title in Rank Math SEO
function update_focus_keywords() {
$posts = get_posts(array(
'posts_per_page' => -1,
'post_type' => 'product' // Replace post with the name of your post type
));
foreach($posts as $p){
// Checks if Rank Math keyword already exists and only updates if it doesn't have it
$rank_math_keyword = get_post_meta( $p->ID, 'rank_math_focus_keyword', true );
if ( ! $rank_math_keyword ){
update_post_meta($p->ID,'rank_math_focus_keyword',strtolower(get_the_title($p->ID)));
@shameemreza
shameemreza / disable-the-stripe-api-requests-from-loading-on-product-pages.php
Created July 7, 2024 14:49
Disable the Stripe API requests from loading on product pages in WooCommerce Stripe Payment Gateway
add_filter( ‘wc_stripe_load_scripts_on_product_page_when_prbs_disabled’, ‘__return_false’ );
add_filter( ‘wc_stripe_load_scripts_on_cart_page_when_prbs_disabled’, ‘__return_false’ );
@shameemreza
shameemreza / set-order-status-to-processing-for-a-virtual-product.php
Created July 7, 2024 14:48
Set order status to processing for a single virtual product in WooCommerce
function virtual_product_woocommerce_order_status( $order_id ) {
if( ! $order_id ) return;
$order = wc_get_order( $order_id );
$order_items = $order->get_items();
$is_virtual_found = false;
$order_product_ids = array();
@shameemreza
shameemreza / delete-action-scheduler-completed-tasks-daily-in-woocommerce.php
Created July 7, 2024 14:38
Automatically delete completed Action Scheduler completed tasks daily in WooCommerce
function wc_as_retention_period() {
return DAY_IN_SECONDS;
}
add_filter( 'action_scheduler_retention_period', 'wc_as_retention_period' );
@shameemreza
shameemreza / set-all-orders-as-processing.php
Created July 7, 2024 14:37
Set all orders as processing in WooCommerce
add_filter( 'woocommerce_order_item_needs_processing', '__return_true' );
@shameemreza
shameemreza / default-calendar-to-the-first-available-booking-in-the-current-month-in-woocommerce-bookings.php
Created July 7, 2024 14:37
Set the default calendar to the first available booking in the current month in WooCommerce Bookings
add_filter( 'wc_bookings_calendar_default_to_current_date', '__return_false' );
@shameemreza
shameemreza / disable-quantity-input-on-product-pages-in-woocommerce.php
Created July 7, 2024 14:36
Disable quantity input on product pages in WooCommerce
add_filter( 'woocommerce_quantity_input_min', 'hide_woocommerce_quantity_input', 10, 2 );
add_filter( 'woocommerce_quantity_input_max', 'hide_woocommerce_quantity_input', 10, 2 );
function hide_woocommerce_quantity_input( $quantity, $product ) {
// only on the product page
if ( ! is_product() ) {
return $quantity;
}
return 1;
}
@shameemreza
shameemreza / disable-the-integration-pixel-in-facebook-for-woocommerce.php
Created July 7, 2024 14:35
Disable the integration pixel in Facebook for WooCommerce
add_filter( 'facebook_for_woocommerce_integration_pixel_enabled', '__return_false' );