T
T
Tereverda2020-06-15 15:26:21
JavaScript
Tereverda, 2020-06-15 15:26:21

jquery stopped working in conjunction with wordpress?

The button for adding a product to the cart stopped working, which works on jquery in woocommerce I

tried a bunch of options, I can’t find what the problem is, connecting scripts through the funcshin file product
example https://ronbel.ru/klejkaya-lenta-malyarnaya-48x40x125

add_action( 'init', 'true_jquery_register' );

function true_jquery_register() {
  if ( !is_admin() ) {
    wp_deregister_script( 'jquery' );
    wp_register_script( 'jquery', ( 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js' ), false, null, true );
    wp_enqueue_script( 'jquery' );
  }
}


// Загрузка библиотек и стилей
function theme_styles() {
  // Стили
  wp_enqueue_style('bootstrap-style', 'https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css', array(), '4.2.1');
  wp_enqueue_style('ronbel_style', get_stylesheet_uri());
  wp_enqueue_style('ronbel_fonts', 'https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap&subset=cyrillic,cyrillic-ext&display=swap');
  wp_enqueue_script('popper-js', 'https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js', false, true);
  wp_enqueue_script( 'bootstrap-js', 'https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js', false, true);
}
add_action( 'wp_enqueue_scripts', 'theme_styles' ); // Хук цепляет стили

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Tereverda, 2020-06-15
@Tereverda

the problem was in the hatches file, the code is correct

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question