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
| /** | |
| * Temporary: WWOF + WWPP — hide non-wholesale variations in REST when loading | |
| * /wc/v3/products/{id}/variations?wwof=… (parent + dropdown on order form). | |
| * Remove after Wholesale Order Form includes an official fix. | |
| */ | |
| add_filter( | |
| 'woocommerce_rest_product_variation_object_query', | |
| static function ( $args, $request ) { | |
| if ( ! $request instanceof WP_REST_Request || ! $request->get_param( 'wwof' ) ) { | |
| return $args; |
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 | |
| /** | |
| * One-off: clear all WWPP product-category percentage discounts (options taxonomy_{id}) | |
| * and sync product meta for category-sourced wholesale flags. | |
| * | |
| * Requires: WooCommerce + Wholesale Prices Premium active. | |
| * Run on staging first; keep a backup. | |
| */ | |
| if ( ! defined( 'ABSPATH' ) ) { | |
| require __DIR__ . '/wp-load.php'; |
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
| Replace wp_ with your actual table prefix. | |
| -- 1) Preview vendors that will be affected | |
| SELECT u.ID, u.user_login | |
| FROM wp_users u | |
| JOIN wp_usermeta cap | |
| ON cap.user_id = u.ID | |
| AND cap.meta_key = 'wp_capabilities' | |
| AND cap.meta_value LIKE '%"vendor"%' |
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
| # BEGIN Really Simple Security Redirect | |
| <IfModule mod_rewrite.c> | |
| RewriteEngine On | |
| RewriteCond %{HTTPS} !=on | |
| RewriteCond %{HTTP:X-Forwarded-Proto} !https [NC] | |
| RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
| </IfModule> | |
| # END Really Simple Security Redirect | |
| # BEGIN LSCACHE |
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
| // Optional manual map from LOCAL -> LIVE (order_id => stripe_invoice_id). | |
| if ( ! defined( 'WPAY_RESYNC_ORDER_MAP' ) ) { | |
| define( 'WPAY_RESYNC_ORDER_MAP', array() ); | |
| } | |
| // Optional force only specific order IDs. | |
| if ( ! defined( 'WPAY_RESYNC_ORDER_IDS' ) ) { | |
| define( 'WPAY_RESYNC_ORDER_IDS', array() ); | |
| } |
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
| /** | |
| * Start output buffer before Wholesale Payments section is rendered. | |
| */ | |
| add_action( 'woocommerce_order_details_after_order_table', function( $order ) { | |
| // Only on front-end order view (e.g. My Account → View order). | |
| if ( ! is_account_page() && ! is_order_received_page() ) { | |
| return; | |
| } | |
| if ( $order->get_payment_method() !== 'wc_wholesale_payments' ) { | |
| return; |
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
| /** | |
| * WC Vendors: Force dashboard menu order (includes "My Custom Page"). | |
| * Add to child theme functions.php or a snippets plugin. | |
| */ | |
| add_action( 'wp_footer', function () { ?> | |
| <style> | |
| @media screen and (min-width: 1071px) { | |
| ul.wcv-dashboard-menu.horizontal.black.primary { | |
| margin-left: 20px; | |
| } |
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
| /** | |
| * Bulk reset store credits to zero for all users in a given role(s). | |
| * | |
| * SETUP: | |
| * 1. Set the role(s) in ACFW_BULK_RESET_DEFAULT_ROLE below (one role, or comma-separated: 'wholesale_customer,trade'). | |
| * 2. Add this snippet (e.g. Code Snippets or a custom plugin). Advanced Coupons (Store Credits) must be active. | |
| * | |
| * TO RUN: | |
| * - Option A: Go to the Dashboard — a "Run now" link is shown. Click it (must have manage_woocommerce). | |
| * - Option B: Open the URL manually with ?role=ROLE and a valid _wpnonce (e.g. from the Dashboard link). The role in the URL overrides the default. |
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
| /** | |
| * WC Vendors Pro: clean up shipping label and avoid "Vendor Shipping". | |
| */ | |
| add_filter( 'wcvendors_pro_shipping_label', function( $label, $vendor_id, $rate ) { | |
| // Change this if you want a different default. | |
| $fallback_method = 'Standard Shipping'; | |
| $vendor_term = function_exists( 'wcv_get_vendor_name' ) ? wcv_get_vendor_name( true, true ) : 'Vendor'; |
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
| /** | |
| * Fix HTML entities in XML feeds | |
| */ | |
| add_filter( 'adt_product_feed_xml_attribute_handling', function( $handled, $product, $key, $value, $feed_config, $channel_attributes, $feed ) { | |
| if ( $handled || ! is_object( $product ) || ! is_object( $feed ) ) { | |
| return $handled; | |
| } | |
| $target_feed_id = 37281; | |
| $is_target_feed = false; |
NewerOlder