This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_footer', function() { | |
?> | |
<script> | |
jQuery(document).ready(function($) { | |
function updateParentPrices() { | |
$('.cart .pewc-parent-product').each(function() { | |
var $parentRow = $(this); | |
var groupClass = $parentRow.attr('class').split(' ').find(c => c.startsWith('pewc_')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'wcvs_use_product_variation_image', function( $use, $product ){ | |
if ( $product->is_type( 'variable' ) && 1 === count( $product->get_variation_attributes() ) ) { | |
$use = true; | |
} | |
return $use; | |
}, 10, 2 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Filter for the minimum quantity when the cart is using WC Blocks | |
* @since 1.3.8 | |
*/ | |
function custom_api_product_quantity_minimum( $quantity, $product, $cart_item ) { | |
$min = wcmmqo_get_min_quantity( $product ); | |
if ( ! empty( $min ) ) { | |
$quantity = $min; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_footer', function() { | |
?> | |
<script> | |
jQuery(document).ready(function($) { | |
// Initialize the packing fee sum | |
let packingFeeTotal = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( "wp_footer", function() { | |
?> | |
<script> | |
jQuery(document).ready(function($) { | |
$('.pewc-child-quantity-field').before('<button type="button" class="minus">-</button>'); | |
$('.pewc-child-quantity-field').after('<button type="button" class="plus">+</button>'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function custom_safari_comma_fix() { | |
?> | |
<script type="text/javascript"> | |
document.addEventListener('DOMContentLoaded', () => { | |
// Detect if the browser is Safari | |
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); | |
if (isSafari) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Some languages (e.g. Finnish/Suomi) encounter the error below when adding a Booking product to the cart: | |
* "PHP Fatal error: Uncaught DateMalformedStringException: Failed to parse time string (marraskuu 08, 2024) at position 0 (m): The timezone could not be found in the database" | |
* Use the snippet below to fix the error (requires 2.0.14+) | |
*/ | |
add_filter( 'bfwc_date_formatter_pattern', function( $pattern ){ | |
return 'LLLL'; | |
}, 10, 1 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Filter wcmo_redirect_referring_page, for compatibility with Filter Everything PRO | |
* Requires WooCommerce Members Only 1.10.19+ | |
*/ | |
add_filter( 'wcmo_redirect_referring_page', function( $referring_page ){ | |
$parts = parse_url( home_url() ); | |
$current_uri = "{$parts['scheme']}://{$parts['host']}" . ( ! empty( $parts['port'] ) ? ':' . $parts['port'] : '' ) . add_query_arg( NULL, NULL ); | |
$referring_page = $current_uri; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function add_user_role_to_body_class($classes) { | |
// Check if the user is logged in | |
if (is_user_logged_in()) { | |
// Get the current user's data | |
$user = wp_get_current_user(); | |
// Check if the user has any roles | |
if (!empty($user->roles) && is_array($user->roles)) { | |
// Append each role to the body class |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_footer', function() { | |
?> | |
<script> | |
jQuery(document).ready(function($) { | |
function updateTotalPrice() { | |
var total = 0; |
NewerOlder