By default Woocommerce loads 50 variations per run.
Searching the web, I found a line of code to be entered in the functions.php
file, of my active child theme.
define( ‘WC_MAX_LINKED_VARIATIONS’, 150);
After copying it in the functions.php
file, I did not get changes and the 50 variations are still being loaded and not 150 as I indicated in the line of code.
This is the functions.php file:
<?php
//CARGA EL STYLE.CSS DEL TEMA PADRE EN EL TEMA HIJO
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
//Incremento de las variaciones en Woocommerce
define( ‘WC_MAX_LINKED_VARIATIONS’, 150);
?>
Just tested it on my local machine and found that define( 'WC_MAX_LINKED_VARIATIONS', 150 );
can be used either in the functions.php
or wp-config.php
.
It is not working for you because WC_MAX_LINKED_VARIATIONS
is not properly enclosed by the single quote ''
, instead it is enclosed by apostrophe
‘’
:
define( ‘WC_MAX_LINKED_VARIATIONS’, 150 );
define( 'WC_MAX_LINKED_VARIATIONS', 150 );
After making above correction, you can use this constant in any of the following ways:
functions.php
file;functions.php
file and add it in your wp-config.php
fileIt should work for you.
WARNING
Problems with large amounts of data not saving (variations, rates etc) .