This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.mkl_pc .mkl_pc_container .mkl_pc_toolbar section.choices ul.layer_choices:not(.display-mode-dropdown) { | |
display: block !important; | |
} | |
.mkl_pc .mkl_pc_container .mkl_pc_toolbar section.choices .layers button.layer-item::after{ | |
display: none; | |
} | |
.mkl_pc .mkl_pc_container .mkl_pc_toolbar section.choices .layers button.layer-item::before{ | |
width: calc( 100% - 1em); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( "woe_fetch_order_products", function ($products, $order, $labels, $format, $static_vals) { | |
foreach( $order->get_items('line_item') as $pos => $item) { | |
if ( $config_data = $item->get_meta( '_configurator_data' ) ) { | |
foreach( $config_data as $selection ) { | |
// Get the item name. E.g. Farve, or Vaelg overdel | |
$layer_name = $selection->get_layer( 'name' ); | |
// Get the item's selected choice. E.g. Lady top loose | |
$choice_name = $selection->get_choice( 'name' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Filter the data in the cart / checkout | |
add_filter( 'mkl_pc/wc_cart_get_item_data/choice', function( $choice_data, $layer ) { | |
$parent_id = $layer->get_choice( 'parent' ); | |
if ( $parent_id && is_callable( [ $layer, 'get_choice_by_id' ] ) ) { | |
$parent = $layer->get_choice_by_id( $parent_id ); | |
if ( $parent && isset( $parent[ 'name' ] ) ) { | |
$choice_data['value'] = $parent[ 'name' ] . ', ' . $choice_data['value']; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'woocommerce_before_cart', function() { | |
WC()->cart->calculate_totals(); | |
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get the hex colors from a product's configurator data | |
* | |
* @param int $product_id | |
* @return array | |
*/ | |
function get_product_colors_from_configuration( $product_id ) { | |
$colors = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@media (max-width: 660px) { | |
.mkl_pc .mkl_pc_container .mkl-pc-show-form { | |
display: none; | |
} | |
.mkl_pc .mkl_pc_container footer .form.form-cart { | |
position: relative; | |
padding: 0; | |
background: transparent; | |
box-shadow: none; | |
border-radius: 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wp.hooks.addAction( 'PC.fe.start', 'Custom_script', function( configurator ) { | |
// Do something here. E.g.: | |
// Get the viewer | |
var viewer = configurator.viewer.$el; | |
// Get the layer container | |
var layers_container = configurator.viewer.$( '.mkl_pc_layers' ); | |
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wp.hooks.addAction( 'PC.fe.viewer.item.added', 'MKL/PC/Custom_JS', function( view, viewer ) { | |
// Set the class name | |
var layer_class = 'layer-' + view.model.get( 'layerId' ); | |
// Find the existing container. | |
var layer_container = viewer.$layers.find( '.' + layer_class ); | |
if ( ! layer_container.length ) { | |
// If the container doesn't exist, add it | |
view.$el.wrap( '<div class="' + layer_class + '" />' ); | |
} else { | |
layer_container.append( view.$el ); |