Sometimes you don't need all of jQuery's modules. Officially, you can use their Grunt script to build a slimmed-down jQuery, but what if Webpack is more your thing? Enter this guide.
- From your project root, install jQuery as a dev dependency:
/* | |
* Adapted from: https://stackoverflow.com/questions/44467377/bootstrap-4-multilevel-dropdown-inside-navigation | |
*/ | |
'use strict'; | |
( function( $ ) { | |
$( '.dropdown-menu a.dropdown-toggle' ).on( 'click', function() { | |
var $subMenu, | |
$this = $( this ), | |
$ancestors = $this.parents( '.dropdown-menu' ), |
Sometimes you don't need all of jQuery's modules. Officially, you can use their Grunt script to build a slimmed-down jQuery, but what if Webpack is more your thing? Enter this guide.
A client wants it so that it's not possible for customers to select product attribute pulldown combinations that refer to either non-existent or out of stock variations (they don't like customers making a selection from four pulldowns only to be told it's invalid). I took a stab at coding a solution that mostly works.
From functions.php
the class SingleProduct
is instantiated and the setup
method is called to kick things off. The JavaScript is in the productVariationFooterScript
method. Every time the user selects an option from an attribute pulldown an AJAX request is made, which is handled by the method ajaxFilterProductAttributeOptions
(it returns valid options for all the other pulldowns, which then get updated by JavaScript). Like I say it mostly works, the attribute pulldown options are filtered properly for the most part, the only hitch I've found is that if the user makes selections from the first three pulldowns sometimes they can hit a combination for which any of the options for the last
Use this script to mount drives in WSL. Example: ezmount.sh f
to mount the F: drive.
Thanks to https://askubuntu.com/a/1422805/778411 for specifying how to make the WSL user the default owner of files.