Я сделал интернет-магазин в WooCommerce.Клиент хотел избежать оригинального интернет-магазина, поэтому я сделал для клиента форму заказа продуктов.Я не могу вспомнить, как и где я изменил файл PHP, чтобы отключить функцию Добавить в корзину .К счастью, у меня есть оригинальные файлы темы, но я боюсь что-то сломать.Не могли бы вы, ребята, помочь мне, пожалуйста?
Я пытался проверить свой CSS, чтобы увидеть, отключил ли я его там, но его там не было.Кроме того, проверил файл function.php
, но я не могу вспомнить, что я изменил.
Мне нужно откатить интернет-магазин, как это было изначально.С его кнопкой «Добавить в корзину» снова.
Пожалуйста, посмотрите на код:
woocommerce.php
<?php
/**
* Plugin Name: WooCommerce
* Plugin URI: https://woocommerce.com/
* Description: An eCommerce toolkit that helps you sell anything. Beautifully.
* Version: 3.5.4
* Author: Automattic
* Author URI: https://woocommerce.com
* Text Domain: woocommerce
* Domain Path: /i18n/languages/
*
* @package WooCommerce
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
// Define WC_PLUGIN_FILE.
if ( ! defined( 'WC_PLUGIN_FILE' ) ) {
define( 'WC_PLUGIN_FILE', __FILE__ );
}
// Include the main WooCommerce class.
if ( ! class_exists( 'WooCommerce' ) ) {
include_once dirname( __FILE__ ) . '/includes/class-woocommerce.php';
}
/**
* Main instance of WooCommerce.
*
* Returns the main instance of WC to prevent the need to use globals.
*
* @since 2.1
* @return WooCommerce
*/
function wc() {
return WooCommerce::instance();
}
// Global for backwards compatibility.
$GLOBALS['woocommerce'] = wc();
function.php
<?php
/* Load child theme stylesheet */
function amourchild_theme_style() {
wp_enqueue_style( 'amourparent-theme-style', get_template_directory_uri() . '/css/style.css' );
wp_enqueue_style( 'amourchild-childtheme-style', get_stylesheet_uri() );
}
add_action( 'wp_enqueue_scripts', 'amourchild_theme_style' , 10);
/* Insert custom functions below */
add_filter( 'woocommerce_is_purchasable', true );
/**
* @snippet Adds prefix and/or suffix to WooCommerce Prices (conditionally per category)
* @how-to Watch tutorial @ https://businessbloomer.com/?p=19055
* @source https://businessbloomer.com/?p=472
* @author Rodolfo Melogli
* @compatible WooCommerce 2.4.7
*/
add_filter( 'woocommerce_get_price_html', 'bbloomer_price_prefix_suffix', 100, 2 );
function bbloomer_price_prefix_suffix( $price, $product ) {
// change 'audio' with your the category slug
if ( has_term( 'everyday-bouquets', 'product_cat' ) ) {
$price = 'From ' . $price . '';
}
if ( has_term( 'everyday-bouquets', 'product_cat' ) ) {
$product_price = 'From ' . $product_price . '';
}
if ( has_term( 'designers-choice', 'product_cat' ) ) {
$price = 'From ' . $price . '';
}
// no need to put the else! $price will stay the same
return apply_filters( 'woocommerce_get_price', $price );
}
/**
* Change currency display in WooCommerce
* Put this in your functions.php file
*
*/
add_filter('woocommerce_currency_symbol', 'change_existing_currency_symbol', 10, 2);
function change_existing_currency_symbol( $currency_symbol, $currency ) {
switch( $currency ) {
case 'USD': $currency_symbol = 'US$ '; break;
}
return $currency_symbol;
}
add_action( 'woocommerce_product_query', 'prefix_custom_pre_get_posts_query' );
/**
* Hide Product Cateories from targetted pages in WooCommerce
* @link https://gist.github.com/stuartduff/bd149e81d80291a16d4d3968e68eb9f8#file-wc-exclude-product-category-from-shop-page-php
*
*/
function prefix_custom_pre_get_posts_query( $q ) {
if( is_shop() || is_page(‘my-shop-page’) ) { // set conditions here
$tax_query = (array) $q->get( 'tax_query' );
$tax_query[] = array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => array( 'romance' ), // set product categories here
'operator' => 'NOT IN'
);
$q->set( 'tax_query', $tax_query );
}
}