Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter tiagonandes

    (@tiagonandes)

    @wooassist Thanks for your answer, I have tried what you suggested and it turns out the theme needed the attribute data-title from the button with the product name, which your plugin does not have defined. If anyone is having the same problem, all I did was add data-title="'. $product->get_name() .'" to the plugin’s button html.

    public function woa_add_quantity_fields($html, $product) {
    		//add quantity field only to simple products
    	if ( $product && $product->is_type( 'simple' ) && $product->is_purchasable() && $product->is_in_stock() && ! $product->is_sold_individually() ) {
    		//rewrite form code for add to cart button
    		$html = '<form action="' . esc_url( $product->add_to_cart_url() ) . '" class="cart" method="post" enctype="multipart/form-data">';
    		$html .= woocommerce_quantity_input( array(), $product, false );
    		$html .= '<button type="submit" data-quantity="1" data-title="'. $product->get_name() .'" data-product_id="' . $product->get_id() . '" class="button alt ajax_add_to_cart add_to_cart_button product_type_simple">' . esc_html( $product->add_to_cart_text() ) . '</button>';
    		$html .= '</form>';			
    	}
    	return $html;
    	}
    Thread Starter tiagonandes

    (@tiagonandes)

    @wooassist here it is. Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)