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
/* Modify the product-edit.php template.. replace the lines between Product Title and ending with the DIV after Product Categories with THIS CODE. */ | |
<div class="wcv-product-basic wcv-product"> | |
<!-- Product Title --> | |
<?php WCVendors_Pro_Product_Form::title( $object_id, $product_title ); ?> | |
<!-- Product Description Editor --> | |
<label>Product Description</label> | |
<?php | |
$editor_args = array( | |
'editor_height' => 300, | |
'media_buttons' => false, |
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
<?php | |
/* WC Vendors Pro - Make Description Required */ | |
function wcv_product_description_required( $args ) { | |
$args[ 'custom_attributes' ] = array( | |
'data-rules' => 'required', // Change 'required' to '' to make it not required (just remove the word required but keep the single quotes) | |
'data-error' => __( 'This field is required.', 'wcvendors-pro' ) | |
); | |
return $args; | |
} |
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
<?php | |
// This snippet will add an extra tab to the buddy press user profile that can call any shortcode defined in WC Vendors. | |
// This code should be inserted into your bp-custom.php file. | |
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() ); | |
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 -- 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 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 | |
/* This goes somewhere in your archive-product.php template. This will check if the URL they are on is a vendor store, | |
* and if it is, do something, if it isn't, do something else. Writhing the somethings is up to you. :) | |
*/ | |
$vendor_shop = urldecode( get_query_var( 'vendor_shop' ) ); | |
$vendor_id = WCV_Vendors::get_vendor_id( $vendor_shop ); | |
if ( $vendor_id ) { | |
// Do something | |
} elseif { |
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
<?php | |
// Add this to your themes functions.php | |
// Remove product tabs on the product-edit form. | |
add_filter( 'wcv_product_meta_tabs', 'remove_product_tabs' ); | |
function remove_product_tabs( $tabs ){ | |
unset( $tabs['general'] ); | |
unset( $tabs['attributes' ] ); |
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
<?php | |
// Place this code in your themes functions.php | |
// Add google analytics code to vendor pages for tracking | |
function wcv_shop_name_google_analytics() { | |
if ( is_singular( 'product') ){ | |
$product = get_queried_object(); | |
if ( WCV_Vendors::is_vendor_product_page( $product->post_author ) ) { |
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
<?php | |
// Restore the (Free) label on the cart and checkout pages | |
add_filter( 'woocommerce_cart_shipping_method_full_label' , 'add_free_shipping_label', 10, 2 ); | |
function add_free_shipping_label( $label, $method ){ | |
if ( $method->cost == 0 ){ | |
$label = $method->label . ' ' . __( '(Free)', 'onesocial' ); | |
} |
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 code in your theme or child theme functions.php | |
// Rename the main dashboard tab labels | |
function change_dashboard_labels( $dashboard_urls ){ | |
// Products | |
if ( array_key_exists('product', $dashboard_urls ) ) $dashboard_urls[ 'product' ][ 'label' ] = 'Mah Products'; | |
// Orders | |
if ( array_key_exists('order', $dashboard_urls ) )$dashboard_urls[ 'order' ][ 'label' ] = 'Mah Orders'; | |
// Settings | |
if ( array_key_exists('settings', $dashboard_urls ) )$dashboard_urls[ 'settings' ][ 'label' ] = 'Mah Settings'; |
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
<?php | |
// Add billing phone to orders table | |
function add_billing_phone( $order_rows ){ | |
foreach ( $order_rows as $key => $row ) { | |
$_order = new WC_Order( $row->ID ); | |
$row->customer = $_order->get_formatted_shipping_address() .'<br />'. $_order->billing_email .'<br />' . $_order->billing_phone; | |
} |