Skip to content

Instantly share code, notes, and snippets.

View arobbins's full-sized avatar
🦾
Building ShopWP

Andrew Robbins arobbins

🦾
Building ShopWP
View GitHub Profile
@arobbins
arobbins / wps-shortcode-wpsproducts.js
Last active April 9, 2018 18:46
WP Shopify - Example - Shortcode - [wps_products]
// Show products from collections "Featured" and "Sale". Limit the amount of products to 10
[wps_products collections="Featured, Sale" limit="10"]
@arobbins
arobbins / buybutton-archive.php
Last active January 29, 2018 03:31
Adding a buy button under each archive product
<?php
function wps_products_show_add_to_cart_callback() {
return true;
}
add_filter( 'wps_products_show_add_to_cart', 'wps_products_show_add_to_cart_callback' );
@arobbins
arobbins / example-bitcoin-transaction.json
Last active January 25, 2018 13:08
Example Bitcoin transaction
{
"ver": 1,
"inputs": [
{
"sequence": 4294967295,
"witness": "",
"prev_out": {
"spent": true,
"tx_index": 326817500,
"type": 0,
@arobbins
arobbins / wps-custom-order-save-data.php
Last active January 23, 2018 18:06
Custom order data example - Save order data
<?php
/*
Step 4. Once the order is successfully paid for ...
The $order parameter contains all the data contained here (scroll down to the Order webhook): https://help.shopify.com/api/reference/webhook
*/
function namespace_checkouts_order_paid($order) {
@arobbins
arobbins / wps-custom-order-data-attrs.php
Last active January 23, 2018 17:56
Custom order data example - Order attributes filter
<?php
/*
Step 3. Saves any dynamic session variables to the Shopify order. Fires once the user clicks the checkout button.
*/
function namespace_cart_checkout_attrs() {
// Gain access to the global $_SESSION variable
@arobbins
arobbins / wps-custom-order-data-ajax-action.php
Last active January 23, 2018 17:51
Custom order data example - AJAX receiver
<?php
/*
Step 2. Save any dynamic values to the users Session
We're calling this function from the frontend javascript via the 'save_dynamic_values_to_session' AJAX action.
*/
function save_dynamic_values_to_session() {
@arobbins
arobbins / wps-custom-order-data-js.js
Last active January 23, 2018 17:40
Custom order data example - AJAX sender
/*
Step 1. Add an AJAX POST request to the add to cart click event.
Resolves through the then() method once the data has been saved. You'll need to
write some jQuery to fill in the "dynamicValues" object according to your own markup
*/
jQuery('.wps-add-to-cart').on('click', function(e) {
function updateDom(arg1) {
 return arg1;
}
@arobbins
arobbins / wps-custom.php
Last active January 5, 2018 03:50
Amanda's WP Shopify customizations
<?php
// Shows / Enables WordPress Sidebar on WP Shopify products-all template
function wps_products_show_sidebar_callback() {
return true;
}
add_filter('wps_products_show_sidebar', 'wps_products_show_sidebar_callback');

Keybase proof

I hereby claim:

  • I am arobbins on github.
  • I am arobbins (https://keybase.io/arobbins) on keybase.
  • I have a public key ASA9j69jqgvPEHf8fTVCUrEc3m0EiH_vd-a-JF3EfGE3VAo

To claim this, I am signing this object: