Please submit a private ticket if you need to share sensitive information, such as license details and admin credentials.

Okay
  Public Ticket #2996846
Default value when required
Closed

Comments

  •  1
    Michiel started the conversation

    Hey guys,

    First of all, wonderful plugin which you've made for WooCommerce. I am testing with the plugin but whenever there is a required product it will always show a default value already. I actually want to start blank where they need to make a decision. In other words, not a prefilled variation. Please find a screenshot attached. Now at 'Levering'  (which means delivery): It has 2 variations (Gratis /Free and 'Premium'. Now it will always select free delivery but I want this to be empty. 

    How can I realize this? Looking forward to hearing from you,

    Regards, Michiel

  •  767
    Janilyn replied

    Hi Michiel,

    Thanks for contacting us here.

    For your case, you can enable the Option None for required components from the plugin setting under WPClever >> Composite Products.

    For more information, you can kindly refer to this doc: https://doc.wpclever.net/wooco/faqs/question-17-option-none-101/.

    Best regards.

    Janilyn T. - WPClever Support Agent

  •  1
    Michiel replied

    Hi Janilyn,

    Thanks for your reply. Is there a way to give a seperate message than the 'empty' option? Now both the messages are the same for a non-required and a required product. How can I do this?

    Regards, Michiel 

  •  767
    Janilyn replied

    Hi Michiel,

    I will assign one of our developers to help you with that. he will respond to you as soon as being available for work. If you have any further question, you can kindly ask him.

    Best regards.

    Janilyn T. - WPClever Support Agent

  •  1,226
    Dustin replied

    Hi Michiel,

    Please add the below custom code (How to add custom code?)

    add_filter( 'wooco_option_none', 'wooco_option_none_for_required', 99, 2 );
    function wooco_option_none_for_required( $text, $component ) {
        if ( $component['optional'] !== 'yes' ) {
            // required component
            return 'Option none for required component';
        }
        return $text;
    }

    And the result https://www.screencast.com/t/83YIjS6o

    You can change the text in the above snippet as you want.

    Best regards,
    Dustin

  •  1
    Michiel replied

    Hey Dustin,

    Thanks a lot for the custom code. The only issue I now have is that it shows 0,00 as a price while this is not relevant in this case.

  •  1
    Michiel replied

    Please find the screenshot attached. Can I get rid of this €0,0 amount?

  •  1,226
    Dustin replied

    Hi Michiel,

    Please add the below custom code (How to add custom code?)

    add_filter( 'wooco_option_none_description', '__return_empty_string', 99 );

    Best regards,
    Dustin

  •  1
    Michiel replied

    Thanks, that helped a lot! Great help, appreciate it.

  •  1,226
    Dustin replied

    You're welcome!smile.png

    If you are satisfied with our plugin and support, please reward it with a full five-star ★★★★★ rating.
    https://wordpress.org/support/plugin/wpc-composite-products/reviews/?filter=5
    Thank you in advance! ♥

    Best regards,
    Dustin