How to Add text value in Automatically in this conditions?

This should work. Untested though. I don’t know how you get $woocomerce_wookc_text, but since you mentioned CMB, I am taking you are saving it as product meta data function wpse405916_add_to_cart( $cart_item_key, $product_id ) { //Get the woocomerce_wookc_text value. $woocomerce_wookc_text = get_post_meta( $product_id, ‘woocomerce_wookc_text ‘, true ); //Check if the value exists if ( $woocomerce_wookc_text && … Read more

Set Button in PluginDocumentSettingPanel Content (WordPress Gutenberg)

I finally solved it like this: var registerPlugin = wp.plugins.registerPlugin; var PluginDocumentSettingPanel = wp.editPost.PluginDocumentSettingPanel; var Button = wp.components.Button; var el = wp.element.createElement; var __ = wp.i18n.__; function onButtonClick() { alert( ‘Button is clicked’ ); } function MyDocumentSettingPlugin() { return el( PluginDocumentSettingPanel, { name: ‘my-document-setting-plugin’, title: ‘My Panel’, icon: ‘dashicon-name’, }, __( ‘My Document Setting Panel … Read more