Archives: Snippets
Untitled Snippet
WWPP – Exclude products from Cart Subtotal Price Discounts if they have an individual price or belong to a specific category
/** * Recalculate the cart subtotal discount to exclude products that: * – belong to a specific product category e.g., ‘music’ , OR * – have an individual wholesale price set for the customer’s role. */ add_filter( ‘wwpp_cart_subtotal_based_discount’, ‘wwpp_recalculate_discount_for_eligible_items’ );…Continue reading
Disable comments
add_action(‘admin_init’, function () { // Redirect any user trying to access comments page global $pagenow; if ($pagenow === ‘edit-comments.php’) { wp_safe_redirect(admin_url()); exit; } // Remove comments metabox from dashboard remove_meta_box(‘dashboard_recent_comments’, ‘dashboard’, ‘normal’); // Disable support for comments and trackbacks in…Continue reading
WWPAY – Add Purchase Order Number field to Wholesale Payments at classic checkout
/** * Add Purchase Order Number field to Wholesale Payments at classic checkout. */ // 1. Render the field — visible only when Wholesale Payments is selected. add_action( ‘woocommerce_review_order_before_submit’, function () { ?>Continue reading
WWOF – Hide the “In Stock Amount” column for non-wholesale customers
/** * Hide the “In Stock Amount” column in Wholesale Order Form for non-wholesale customers. * * Uses the wwof_order_form_body_meta filter to strip the in-stock-amount column * when the current user does not have a wholesale role. */ add_filter( ‘wwof_order_form_body_meta’,…Continue reading
Charitable: Force PayPal Legacy gateway
/** * Charitable — Force PayPal Legacy gateway on this site. * * Overrides Charitable Pro 1.8.15+ PayPal tier detection at read-time * so the legacy `paypal` gateway stays visible (and PayPal Commerce stays * hidden) regardless of what was…Continue reading
Remove ISO 4217 for Google Feeds
// Force localization for all feeds add_filter(‘adt_product_feed_localize_price_args’, function($args) { $args[‘decimal_separator’] = ‘.’; $args[‘thousand_separator’] = ‘,’; return $args; }); add_filter(‘adt_pfp_localize_price_iso4217_feeds’, function($feeds) { // Remove all Google feeds from ISO4217 formatting return array_filter($feeds, function($feed) { return strpos($feed, ‘google_’) !== 0; }); });Continue reading
Remove ISO 4217 Format for specific feeds
//Google Feeds add_filter(‘adt_pfp_localize_price_iso4217_feeds’, function($feeds) { // Remove all Google feeds from ISO4217 formatting return array_filter($feeds, function($feed) { return strpos($feed, ‘google_’) !== 0; }); }); //Facebook Feeds add_filter(‘adt_pfp_localize_price_iso4217_feeds’, function($feeds) { // Remove all Facebook feeds from ISO4217 formatting return array_filter($feeds, function($feed)…Continue reading
Force localized currency for product feeds
// Force localization for all feeds add_filter(‘adt_product_feed_localize_price_args’, function($args) { $args[‘decimal_separator’] = ‘.’; $args[‘thousand_separator’] = ‘,’; return $args; });Continue reading