Skip to content

Instantly share code, notes, and snippets.

⚙️
Working on WP Shopify 2.0

Andrew Robbins arobbins

⚙️
Working on WP Shopify 2.0
Block or report user

Report or block arobbins

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@arobbins
arobbins / wps-shortcode-wpsproducts.js
Last active Apr 9, 2018
WP Shopify - Example - Shortcode - [wps_products]
View wps-shortcode-wpsproducts.js
// 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 Jan 29, 2018
Adding a buy button under each archive product
View buybutton-archive.php
<?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 Jan 25, 2018
Example Bitcoin transaction
View example-bitcoin-transaction.json
{
"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 Jan 23, 2018
Custom order data example - Save order data
View wps-custom-order-save-data.php
<?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 Jan 23, 2018
Custom order data example - Order attributes filter
View wps-custom-order-data-attrs.php
<?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 Jan 23, 2018
Custom order data example - AJAX receiver
View wps-custom-order-data-ajax-action.php
<?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 Jan 23, 2018
Custom order data example - AJAX sender
View wps-custom-order-data-js.js
/*
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) {
@arobbins
arobbins / wps-custom.php
Last active Jan 5, 2018
Amanda's WP Shopify customizations
View wps-custom.php
<?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');
View keybase.md

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:

You can’t perform that action at this time.