Quickbuy button shortcode
-
Hi,
i updated this plugin from 1.8 to 2.4, all went smooth except one shortcode i was using:[wc_quick_buy label=”BUY” product=”‘ . $product->get_id() . ‘” qty=”1″ type=”button” htmlclass=”single_add_to_cart_button” css_class=”single_add_to_cart_button” ]
I tried to use both “htmlclass” and “css_class” after digging into your code because my prev shortcode had just the “css_class” attribute.
After i couldn’t get it to work, i went again inside your code and find in this file wp-content/plugins/woocommerce-quick-buy/includes/shortcodes/class-button.php the following:protected function defaults() { return array( 'label' => Helper::option( 'button_label' ), 'product' => false, 'qty' => Helper::option( 'quantity', 1 ), 'hide_in_cart' => Helper::option( 'hide_if_in_cart' ), 'css_class' => Helper::option( 'css_class' ), ); }
Later on in the same file inside output function you have this:
$instance = new Button_Generator( array( 'type' => 'link', 'product' => $shortcode_product, 'qty' => $this->option( 'qty' ), 'label' => $this->option( 'label' ), 'hide_in_cart' => $this->option( 'hide_in_cart' ), 'class' => $this->option( 'htmlclass' ), ) ); return $instance->html();
As you can see you are looking for “htmlclass” inside the options, but you should instead look for “css_class”. Indeed after modifying your code all was working again for me. Unfortunatly your plugin kinda lack of apply_filters so i had no other way to make it work. Would it be possibile for you to fix it in the next release?
Thank you for your amazing plugin!
- The topic ‘Quickbuy button shortcode’ is closed to new replies.