I
I
Ilya Derevyannykh2021-06-24 10:27:43
WooCommerce
Ilya Derevyannykh, 2021-06-24 10:27:43

How to write in the code if the goods are from the category, then apply this to it?

I change the text on the "Add to Cart" button like this:

function rog_shop_strings( $translated_text, $text, $domain ) {	
  if( 'woocommerce' === $domain) {
    switch ( $translated_text ) {
      case 'Добавить в корзину' :
      $translated_text = 'Арендовать';
      case 'Подробнее' :
      $translated_text = 'Характеристики';
      break;
    }
  }
  return $translated_text;
}
add_filter( 'gettext', 'rog_shop_strings', 20, 3 );

How to write in it that if the products from the category with the id or id of the product are such then, then this rule does not apply to it.

And how can css be applied to a specific product or product category as well?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question