• Resolved calabronelampa

    (@calabronelampa)


    Hi,
    i want to know if exists a function that stop the ” add product ” on vendor profile when price is 0.

    I need to show a message if price is equal zero and don’t continue with product addition.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • @calabronelampa, you can display a message that the vendor must provide a price to the product by doing custom code.

    This code snippet might help you out further –

    add_action( 'wcmp_before_post_update', 'wcmp_before_post_update_callback1' );
    function wcmp_before_post_update_callback1(){
            $gallery_ids = isset( $_POST['_regular_price'] ) ? $_POST['_regular_price'] : '';
            if(!$gallery_ids){
                wc_add_notice( 'You must add price or image or description', 'error' );
                wp_redirect( apply_filters( 'wcmp_vendor_save_product_redirect_url', wcmp_get_vendor_dashboard_endpoint_url( get_wcmp_vendor_settings( 'wcmp_edit_product_endpoint', 'vendor', 'general', 'edit-product' ), $_POST['post_ID'] ) ) );
                exit;
            }
    }
    Thread Starter calabronelampa

    (@calabronelampa)

    Hi,
    i changed the if condition and it works.

    Thank u so much !

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘DISABLE ADD PRODUCT IF PRICE PRODUCT IS EQUAL ZERO’ is closed to new replies.