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 the following code to your themes functions.php file. | |
| FIXED $ AMOUNT FOR COMMISSIONS: | |
| Rather than paying a percentage of each sale, you may wish to pay a set dollar amount per sale. | |
| To do this, change the commission percentage in your settings to "5". If you do that, you will | |
| send out $5 in commissions per item sold, rather than 5%. Of course, use your own figures | |
| and test before going live. | |
| add_filter( 'wcv_commission_rate', 'my_wcv_custom_filter', 10, 3 ); | |
| function my_wcv_custom_filter( $commission, $product_id, $product_price ) { |
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
| ==== SHORTCODES FOR WC VENDORS FREE ONLY ==== | |
| WC Vendors Free Dashboard page - [wcv_vendor_dashboard] | |
| WC Vendors Free Shop Settings page, normally a child page of the Dashboard - [wcv_shop_settings] | |
| WC Vendors Free Orders page, normally a child page of the dashboard - [wcv_orders] | |
| Directory of Vendors (To edit template, copy and modify ./templates/front/vendor-list.php) | |
| [wcv_vendorslist] Accepts arguments of: | |
| orderby='registered' (default) | |
| order='ASC' (default) | |
| per_page='12' (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
| add_action('_wcv_admin_before_store_commission', 'custom_wcv_admin_before_store_commission'); | |
| function custom_wcv_admin_before_store_commission(){ | |
| $user_id = $_GET['user_id']; // On the WordPress user edit screen, this will get the user id of the account you are currently editing. | |
| $key = get_user_meta( $user_id, '_stripe_connect_access_key', true ); | |
| if ( empty( $key ) ) { | |
| echo '<h2>This vendor is NOT connected to Stripe.</h2>'; | |
| } else { | |
| echo '<h2>This vendor is connected to Stripe. Yay!</h2>'; | |
| } | |
| } |
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_filter( 'init', 'wc_tax_exempt_user_roles' ); | |
| function wc_tax_exempt_user_roles() { | |
| if ( ! is_admin() ) { | |
| global $woocommerce; | |
| if ( current_user_can('wholesaler') || current_user_can('distributor') ) { | |
| $woocommerce->customer->set_is_vat_exempt(true); | |
| } else { | |
| $woocommerce->customer->set_is_vat_exempt(false); | |
| } |
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
| /* - Courtesy of Ben Lumley - https://www.wcvendors.com/help/topic/howto-add-acf-fields-to-frontend-shop-edit/ | |
| * | |
| * This will display + save any custom fields applicable to the vendor_shop in question. Second one displays the fields, you can adjust the action it’s attached to in order * to move the fields (see templates/dashboard/store-settings.php in the pro plugin for possible actions). You could also split and display different fields in different * places – see the docs for acf_form, you can select single/groups of fields. | |
| * http://www.advancedcustomfields.com/resources/acf_form/ | |
| * Also possible via acf_form to alter the markup a bit to make it fit your theme. | |
| * | |
| * This code is not supported by WC Vendors, use at your own risk and at your own discretion. | |
| */ | |
| add_action('wcvendors_settings_after_shop_name', 'wcv_save_acf_fields'); |
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 - Add a custom link to your Pro Dashboard navigation bar */ | |
| add_filter( 'wcv_pro_dashboard_urls', 'custom_menu_link' ); | |
| function custom_menu_link( $pages ) { | |
| $pages[ 'custom_link' ] = array( | |
| 'slug' => 'http://yoursite.com/customlink/here', // Change this to whatever you like, it must be a full URL | |
| 'label' => __('My Custom Link', 'wcvendors-pro' ), | |
| 'actions' => array() | |
| ); | |
| return $pages; | |
| } |
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
| /* Credit to @criticalachievement */ | |
| // Changes the default value for manage stock checkbox to checked | |
| add_filter( 'wcv_product_manage_stock', 'change_default_manage_stock' ); | |
| function change_default_manage_stock() { | |
| $field['post_id'] = $post_id; | |
| $field['id'] = '_manage_stock'; | |
| $field['wrapper_class'] = 'show_if_simple show_if_variable'; |
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 -- Require a minimum, and a maximum price for vendors when adding/editing a product */ | |
| add_filter( 'wcv_product_price', 'price_min_max' ); | |
| function price_min_max( $args ){ | |
| $args[ 'custom_attributes' ] = array( | |
| 'data-rules' => 'decimal|range[1,20]', | |
| 'data-error' => __( 'Price should be a number and between $1 and $20', 'wcvendors-pro' ) | |
| ); | |
| 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
| /* WC Vendors Pro -- No % for commission, just a tiered fee structure */ | |
| add_filter( 'wcv_commission_rate', 'my_wcv_commission_rate', 10, 5 ); | |
| function my_wcv_commission_rate( $commission, $product_id, $product_price, $order, $qty ) { | |
| // First, reduce price to qty1 to do calculations | |
| $product_price = $product_price / $qty; | |
| // Second, run through the price and apply the right commission fee | |
| if ( $product_price > 48.99 ) { | |
| $commission_fee = 3.36; |
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 - Change Apply to become a vendor? on registration pages */ | |
| add_filter( 'wcvendors_vendor_registration_checkbox', 'custom_wcvendors_vendor_registration_checkbox', 10, 1 ); | |
| function custom_wcvendors_vendor_registration_checkbox( $message ) { | |
| $message = "Apply to become an Expert?"; | |
| return $message; | |
| } | |
| /* WC Vendors - Change Seller Info to Expert Details */ | |
| add_filter( 'wcvendors_seller_info_label', 'custom_wcvendors_seller_info_label', 10, 1 ); | |
| function custom_wcvendors_seller_info_label( $message ) { |
NewerOlder