Guest User

Untitled

a guest
Apr 26th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. /* add to your theme or child theme functions.php file to create a new field on the vendor add-edit product form */
  2. add_action( 'wcv_product_options_general_product_data', 'wcv_custom_product_msrp_price_field' );
  3. function wcv_custom_product_msrp_price_field () {
  4. WCVendors_Pro_Form_Helper::input( array(
  5. 'post_id' => $post_id,
  6. 'id' => '_wcv_custom_product_msrp_price',
  7. 'label' => __( 'MSRP Price', 'wcvendors-pro' ),
  8. 'placeholder' => __( 'MSRP Price', 'wcvendors-pro' ),
  9. 'desc_tip' => 'true',
  10. 'description' => __( 'Please specify MSRP Price', 'wcvendors-pro' ),
  11. )
  12. );
  13. }
  14. /* add to your theme or child theme functions.php to display the field entry on the product page for customer view */
  15. add_action('woocommerce_before_add_to_cart_form', 'wcv_custom_product_msrp_price_display');
  16. function wcv_custom_product_msrp_price_display() {
  17. $output = get_post_meta(get_the_ID(), '_wcv_custom_product_msrp_price',true );
  18. echo '<p>'.'Retail Price: ' . $output . '</p>';
  19. }
Add Comment
Please, Sign In to add comment