Skip to content

Instantly share code, notes, and snippets.

View ronaldkubo's full-sized avatar

Ronald Postma ronaldkubo

View GitHub Profile
@ronaldkubo
ronaldkubo / snippet_qty-input-archive_ajax_add-class.php
Created March 20, 2019 10:31
Add quantity input with Ajax to WC archive pages and add a class to products that are already in the cart (after page reload or revisit).
<?php
/**
* Sources:
* https://gist.github.com/webaware/6260468
* https://stevenfies.com/use-javascript-add-new-class-wordpress-element/
* https://stackoverflow.com/questions/3057317/run-a-javascript-function-from-a-php-if-statement
* https://stackoverflow.com/questions/17629404/echo-php-variable-inside-jquery-function
*
* This snippet was compiled by Ronald Postma for Medische Artikelen SMA BV from the above sources.
* The goal is to: