Custom WooCommerce Status

** * Register new post status with WordPress */ add_action( ‘init’, ‘wcvendors_custom_status_action’ ); function wcvendors_custom_status_action() { register_post_status( ‘wc-custom-status’, array( ‘label’ => __( ‘Custom Status’, ‘wc-vendors’ ), ‘public’ => true, ‘show_in_admin_status_list’ => true, ‘label_count’ => _n_noop( ‘Custom Status (%s)’, ‘Custom Status…Continue reading

Min-Max Product Price (with decimal support)

add_filter( ‘wcv_product_price’, ‘price_min_max’ ); function price_min_max( $args ) { $args[‘custom_attributes’] = array( ‘min’ => 3.2, ‘max’ => 200.21, ‘step’ => 0.01, ‘data-parsley-type’ => ‘number’, ‘data-parsley-range-message’ => __( ‘Price must be between 3.2 and 200.01’, ‘wcvendors-pro’ ), ‘pattern’ => ‘[0-9]+([\.,][0-9]+)?’, ‘type’…Continue reading

Set a minimum, and maximum price for products

add_filter( ‘wcv_product_price’, ‘price_min_max’ ); function price_min_max( $args ) { $args[‘custom_attributes’] = array( ‘min’ => 3, ‘max’ => 200, ‘data-parsley-type’ => ‘number’, ‘data-parsley-range-message’ => __( ‘Price must be between 3 and 200’, ‘wcvendors-pro’ ), ‘pattern’ => ‘\d*’, ); return $args; }Continue reading

Use Full Store Address in Ships From

add_filter( ‘wcv_product_ships_from’, ‘ships_from_address’ ); function ships_from_address( $field ){ global $post, $product; $shipping_disabled = wc_string_to_bool( get_option( ‘wcvendors_shipping_management_cap’, ‘no’ ) ); $post = get_post( $product->get_id() ); if ( $product->needs_shipping() && ! $shipping_disabled && WCV_Vendors::is_vendor( $post->post_author ) ) { $vendor_id = WCV_Vendors::get_vendor_from_product( $product->get_id()…Continue reading

Custom Tab Order For Dashboard

add_filter( ‘wcv_dashboard_pages_nav’, ‘change_nav_order’); function change_nav_order( $pages ){ $new_nav_order = array(); $new_nav_order[‘dashboard_home’] = $pages[‘dashboard_home’]; $new_nav_order[‘order’] = $pages[‘order’]; $new_nav_order[‘product’] = $pages[‘product’]; $new_nav_order[‘rating’] = $pages[‘rating’]; $new_nav_order[‘shop_coupon’] = $pages[‘shop_coupon’]; $new_nav_order[‘settings’] = $pages[‘settings’]; $new_nav_order[‘view_store’] = $pages[‘view_store’]; return $new_nav_order;Continue reading