Skip to content

Instantly share code, notes, and snippets.

View woogists's full-sized avatar

WooGists woogists

View GitHub Profile
@woogists
woogists / change-checkout-urls-to-product-urls.php
Created April 26, 2021 05:51
For the Facebook for WooCommerce extension. By default, the link that is shared with Facebook is an “Add to Cart” URL for your product to speed up the checkout process. You may want this to be the product URL for a number of reasons. If so, you can use this code snippet to send the product URL to Facebook instead - https://docs.woocommerce.com/d…
<?php // only copy this line if needed
/**
* Change checkout URLs to product URLs for Facebook products
*/
function sv_fbw_checkout_url_to_product( $product_data, $id ){
$product_data['checkout_url'] = $product_data['url'];
@woogists
woogists / woocommerce-usps-letters-and-envelopes.php
Last active December 29, 2023 19:51
USPS: Add Envelope as a service
<?php
/**
* Add letters and envelopes to international services.
*/
add_filter( 'wc_usps_services', function( $services ) {
$services['I_FIRST_CLASS']['services']['13'] = "First Class Mail&#0174; International Letters";
$services['I_FIRST_CLASS']['services']['14'] = "First Class Mail&#0174; International Large Envelope";
return $services;
@woogists
woogists / functions.php
Last active October 7, 2023 17:39
[WooCommerce Bookings]: Set custom Google client ID and secret
<?php
/**
* Update Google client with your own application's cliend ID and secret from the Google Developer's Console.
*/
add_action(
'woocommerce_bookings_update_google_client',
function ( Google_Client $client ) {
$client->setClientId( 'YourClientIDFromGoogleDevelopersConsole' );
$client->setClientSecret( 'YourClientIDFromGoogleDevelopersConsole' );
<?php
add_filter( 'wc_shipment_tracking_get_providers' , 'wc_shipment_tracking_add_custom_provider' );
/**
* wc_shipment_tracking_add_custom_provider
*
* Adds custom provider to shipment tracking
* Change the country name, the provider name, and the URL (it must include the %1$s)
* Add one provider per line
@woogists
woogists / gist:9bd427bdf92e966d7f368355f97e17b2
Created March 20, 2019 22:39
Bookings REST API Bookings JSON Response
[
{
"all_day": true,
"cost": "100",
"customer_id": 1,
"date_created": 1551471271,
"date_modified": 1551593795,
"end": 1551571199,
"google_calendar_event_id": "uhd8bir3raajo4tco365foii1o",
"order_id": 154167,
@woogists
woogists / gist:04acb250c38f042911a97a46bd3815db
Last active October 7, 2023 17:40
Bookings REST API Products JSON Response
[
{
"id": 171578,
"name": "Candy Land",
"slug": "candy-land",
"permalink": "https://yoursite.test/product/candy-land/",
"date_created": "2019-03-19T10:54:48",
"date_created_gmt": "2019-03-19T17:54:48",
"date_modified": "2019-03-19T15:37:38",
"date_modified_gmt": "2019-03-19T22:37:38",
@woogists
woogists / gist:75b8b462855fe8c981d543b028815bd7
Created March 19, 2019 22:47
Bookings REST API Resources JSON Response
[
{
"id": 145546,
"availability": [],
"base_cost": 0,
"block_cost": 0,
"name": "The Vault",
"parent_id": 0,
"qty": "5",
"sort_order": 0,
@woogists
woogists / gist:cb71b7208cd870a08e6beba773b42988
Last active October 7, 2023 17:40
Bookings REST API Categories JSON Response
[
{
"id": 484,
"name": "Accessories",
"slug": "accessories",
"parent": 0,
"description": "",
"display": "default",
"image": null,
"menu_order": 0,
@woogists
woogists / gist:bd4065d14cb74bb76db7fdbdbdcc77c9
Last active October 7, 2023 17:40
Bookings REST API Slots JSON Response
{
"records": [
{
"date": "2019-03-19T00:00:00-0700",
"duration": 1,
"duration_unit": "day",
"booked": 0,
"available": 1,
"resources": {
"0": 1
@woogists
woogists / storefront-logo-size-adjust-example.css
Created October 26, 2018 13:34
Adjust the dimensions of the header logo in the Storefront theme.
@media screen and (min-width: 768px) {
.woocommerce-active .site-header .site-branding img {
max-width: 40%; /* Adjust this percentage up or down to make the logo larger or smaller. */
}
}