O
O
Olga2020-05-04 21:08:46
WordPress
Olga, 2020-05-04 21:08:46

How to rename the Accessories and Specification tabs?

Hello. There is WP version 5.4.1 and WooCommerce. On the product pages, there are "Accessories", "Description" and "Specification" tabs at the bottom. Here's how to rename these 2 tabs? Screenshot in attachment. 5eb059f78d2bb252620603.png

Just for everyone, I hang the code of the specifications.php file of the template:

<?php

if ( ! defined( 'ABSPATH' ) ) {
  exit; // Exit if accessed directly
}

global $product;

$product_id = electro_wc_get_product_id( $product );
$specifications = get_post_meta( $product_id, '_specifications', true );
$specifications_display_attributes = get_post_meta( $product_id, '_specifications_display_attributes', true );

if ( $specifications_display_attributes == 'yes' && ( $product->has_attributes() || ( apply_filters( 'wc_product_enable_dimensions_display', true ) && ( $product->has_dimensions() || $product->has_weight() ) ) ) ) {
  $attributes_title = get_post_meta( $product_id, '_specifications_attributes_title', true );
  if ( $attributes_title ) {
    echo wp_kses_post( '<h2>' . $attributes_title . '</h2>' );
  }

  if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '2.7', '<' ) ) {
    $product->list_attributes();
  } else {
    wc_display_product_attributes( $product );
  }
}

if ( is_elementor_activated() ) {
  $content = \Elementor\Plugin::$instance->frontend->remove_content_filter();
  echo apply_filters( 'the_content', wp_kses_post( $specifications ) );
  $content = \Elementor\Plugin::$instance->frontend->add_content_filter();
} else {
  echo apply_filters( 'the_content', wp_kses_post( $specifications ) );
}

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