1

I am currently making an e-commerce on woocommerce. On my Shop/Catalog page, I used variation products which display select options button I need to remove this button to add to cart button.

1 Answer 1

-1

Do you mean you need to replace the button of select options with add to cart

Please check below code

add_filter( 'woocommerce_product_add_to_cart_text' , 'custom_select_options_text' );
  function custom_select_options_text() {
  global $product;
  $product_type = $product->product_type;
  switch ( $product_type ) {
  case 'subscription':
  return __( 'Options', 'woocommerce' ); /*change 'Options' for Simple Subscriptions */
  case 'variable-subscription':
  return __( 'Options', 'woocommerce' ); /*change 'Options' for Variable Subscriptions */
  case 'variable':
  return __( 'Options', 'woocommerce' ); /*change 'Options' for Variable Products */
  case 'simple':
  return __( 'Add to Cart', 'woocommerce' ); /*change 'Add to Cart' for Simple Products */
  break;
      }
  }
4
  • Yes that I want Jul 25, 2018 at 5:45
  • Edited answer please check Jul 25, 2018 at 5:54
  • Pratik Bhatt this been change only text, not functionality I want Select options button to replace with add to cart functionality. Jul 25, 2018 at 5:56
  • I think it will not be possible as you need to select the options before adding the product to cart Jul 25, 2018 at 6:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.