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 | |
/* | |
* The following code assumes you have an WC Order object already. We'll be adding a discount to an order. | |
* This code cannot be added directly anywhere, it is merely an explanation of how this can be done. | |
* We will add a discount to the order using Fees | |
*/ | |
/* Assume order is set up already */ | |
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 | |
/* | |
* In this GIST, we register a webhook that will be available for other applications to call e.g. JSON | |
* This code could be added to functions.php or your own plugin. | |
*/ | |
//Register an end point for logged in users | |
add_action("wp_ajax_my_webhook", "my_webhook"); | |
//Register an end point for logged out users |
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 | |
use App\Team; | |
use Laravel\Spark\Spark; | |
use Laravel\Spark\Contracts\Interactions\Settings\Teams\AddTeamMember; | |
//Get a Spark User | |
$sparkUser = Spark::user()->where('email', '[email protected]')->first(); | |
//TODO: Check user exists |
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 | |
use App\Team; | |
use Laravel\Spark\Spark; | |
use Laravel\Spark\Interactions\Settings\Teams\CreateTeam; | |
//Create a User | |
$sparkUser = Spark::user(); | |
$sparkUser->forceFill([ |
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 | |
/* An example of two methods to retrieve only WooCommerce Bookings Products */ | |
use WC_Product_Booking_Data_Store_CPT; | |
$booking_products_ids = WC_Product_Booking_Data_Store_CPT::get_bookable_product_ids(); | |
foreach($booking_products_ids as $id) { | |
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
/* This code is NOT safe for production usage. Do not use in live systems */ | |
/* Add to functions.php */ | |
add_action( 'gform_after_submission', 'wc_demo_cancel_sub', 10, 2 ); | |
function wc_demo_cancel_sub( $entry, $form ) { | |
//Get the subscription id from the form | |
//We assume the field wc_sub_id contains the subscription ID |
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
$body = new \Square\Models\CreateOrderRequest; | |
//Add 5 of the same line items | |
//We are creating them dynamically | |
$qty = 5; | |
$lineItem = new \Square\Models\OrderLineItem($qty); | |
$lineItem->setName('Latte'); | |
$money = new \Square\Models\Money; | |
$money->setCurrency('CAD'); | |
//Amount in Cents e.g. $5.50 |
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 | |
namespace GroundhoggDisposable; | |
use Groundhogg\Contact; | |
/* | |
* Plugin Name: Groundhogg - Disposable Email Checker | |
* Plugin URI: https://www.wooninja.io/?utm_source=wp-plugins&utm_campaign=groundhogg-disposable&utm_medium=wp-dash | |
* Description: Remove disposable emails from your Groundhogg List |
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 | |
/* | |
* Plugin Name: Groundhogg - Loom Replacements | |
* Plugin URI: | |
* Description: Adds a replacement code to embed Loom videos in Groundhogg Emails | |
* Version: 1.0 | |
* Author: Colin Longworth | |
* Author URI: http://www.wooninja.io | |
* Developer: Colin Longworth |
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 | |
/* | |
* Plugin Name: WooCommerce Customer Blocker for Groundhogg | |
* Plugin URI: | |
* Description: Block customers at the checkout using tags in Groundhogg | |
* Version: 1.0 | |
* Author: Colin Longworth | |
* Author URI: http://www.wooninja.io | |
* Developer: Colin Longworth |
OlderNewer