This file contains 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
// Set Vendors Store Icon as Open Graph image on shop page | |
function my_opengraph_image( $img ) { | |
if ( WCV_Vendors::is_vendor_page() ) { | |
$vendor_shop = urldecode( get_query_var( 'vendor_shop' ) ); | |
$vendor_id = WCV_Vendors::get_vendor_id( $vendor_shop ); | |
$store_icon_src = wp_get_attachment_image_src( get_user_meta( $vendor_id, '_wcv_store_icon_id', true ), 'full' ); | |
// see if the array is valid | |
if ( is_array( $store_icon_src ) ) { | |
$img = $store_icon_src[0]; |
This file contains 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 some new page links to the Pro Dashboard */ | |
function new_dashboard_pages( $pages ){ | |
$pages[] = array( 'label' => 'New Link', 'slug' => 'http://mysomelink.com' ); // Add stuff here | |
return $pages; | |
} | |
add_filter( 'wcv_pro_dashboard_urls', 'new_dashboard_pages' ); |
This file contains 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
/* Code by Fervous | |
* WC Vendors - Shows a "My Products" tab in BuddyPress and then the vendors products in that tab | |
*/ | |
function my_bp_nav_adder() { | |
if (class_exists('WC_Vendors')) { | |
$wcv_profile_id = bp_displayed_user_id(); | |
$wcv_profile_info = get_userdata( bp_displayed_user_id() ); | |
if ( $wcv_profile_info->roles[0] == "vendor" ) { |
This file contains 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 - My Custom Bank Fields */ | |
function store_bank_details( ){ | |
if ( class_exists( 'WCVendors_Pro' ) ){ | |
$key = '_wcv_custom_settings_bankname'; | |
$value = get_user_meta( get_current_user_id(), $key, true ); | |
// Bank Name | |
WCVendors_Pro_Form_Helper::input( array( | |
'id' => $key, | |
'label' => __( 'Banküberweisung als Auszahlungs Methode Ihres Provision verwenden', 'wcvendors-pro' ), | |
'placeholder' => __( 'Bank Name', 'wcvendors-pro' ), |
This file contains 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 another file uploader to upload a file with the ID in a meta key */ | |
function custom_wcv_file_uploader( ){ | |
$value = get_user_meta( get_current_user_id(), 'wcv_custom_product_file1', true ); // Must match meta key used in line 8 | |
WCVendors_Pro_Form_Helper::file_uploader( array( | |
'header_text' => __('File uploader', 'wcvendors-pro' ), | |
'add_text' => __('Add file', 'wcvendors-pro' ), | |
'remove_text' => __('Remove file', 'wcvendors-pro' ), | |
'image_meta_key' => 'wcv_custom_product_file1', // Must match meta key used in line 3 | |
'save_button' => __('Add file', 'wcvendors-pro' ), | |
'window_title' => __('Select an Image', 'wcvendors-pro' ), |
This file contains 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
Gives vendors an option to allow gift wrapping. Requires https://wordpress.org/plugins/woocommerce-product-gift-wrap/ | |
// Goes in your product-edit.php template, anywhere you see fit for it | |
WCVendors_Pro_Form_Helper::input( | |
array( | |
'post_id' => $object_id, | |
'id' => 'wcv_custom_product_gift_wrapper_enable', | |
'label' => __( 'Let buyer choose product to be wrapped?', 'wcvendors-pro' ), | |
'type' => 'checkbox' |
This file contains 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 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 - A quick action for showing a string of text on the | |
* my account page for a general terms and conditions for all users | |
* not just vendors. */ | |
add_action( 'woocommerce_register_form', 'wcvendors_extra_myaccount_text' ); | |
function wcvendors_extra_myaccount_text() { | |
echo '<strong>Important</strong> -- By registering to this site you agree to our <a href="/whatever/" target="top">General Terms and Conditions</a>.'; | |
} |
This file contains 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 - Custom Description Placeholder Text */ | |
function custom_wcv_product_description( $args ) { | |
$args = array( | |
'placeholder' => __( 'Placeholder Text Here', 'wcvendors-pro' ) | |
); | |
return $args; | |
} | |
add_filter( 'wcv_product_description', 'custom_wcv_product_description'); | |
/* WC Vendors Pro - Custom Title Placeholder Text */ |
This file contains 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
// Put this in your themes function.php | |
function vendor_feedback_sidebar() { | |
if ( is_shop() ) { | |
$vendor_shop = urldecode( get_query_var( 'vendor_shop' ) ); | |
$vendor_id = WCV_Vendors::get_vendor_id( $vendor_shop ); | |
if ( ! WCVendors_Pro::get_option( 'ratings_management_cap' ) ) echo WCVendors_Pro_Ratings_Controller::ratings_link( $vendor_id, true ); | |
} | |
} // vendor_feedback_sidebar() | |
// call this in your side bar |