Skip to content

Instantly share code, notes, and snippets.

View OneStep21's full-sized avatar

Max OneStep21

View GitHub Profile
{
"url": "createcontractforproductbytokenfromexternalapi",
"data_url": {
"token": "c61ad50a-546e-4e3c-8e35-5edf080ee6c9",
"guid": "cb86e247-9266-11ec-8da7-4c526235f1b4",
"beginperiod": "18.05.2023",
"endperiod": "23.05.2023",
"insurant": {
"name": "Babara Maxim",
"idnp": "2006025057199",
<?php // Do not include this if already open! Code goes in theme functions.php.
/*
* Add new supported product types to Apple Pay
* This sample adds WP Job Manager supports,
* you can add your own product type in the array.
*
* @return array
*/
function wc_stripe_apple_pay_add_supported_types() {
@OneStep21
OneStep21 / Post JSON Data Using cURL in PHP
Last active July 29, 2021 08:25
Next, we’ve used the CURLOPT_HTTPHEADER option to set the Content-Type header to application/json to inform the API server that we’re sending JSON data.
<?php
$url = '{POST_REST_ENDPOINT}';
$curl = curl_init();
$fields = array(
'field_name_1' => 'Value 1',
'field_name_2' => 'Value 2',
'field_name_3' => 'Value 3'
);
@OneStep21
OneStep21 / move-stripe-button.php
Created July 25, 2019 14:50
Moving the WooCommerce Stripe Payment Request buttons and Stripe Payment Request Button Separator below the add to card button.
/* Move Stripe Payment Request Button on product page */
remove_action( 'woocommerce_after_add_to_cart_quantity', array( WC_Stripe_Payment_Request::instance(), 'display_payment_request_button_html' ), 1 );
remove_action( 'woocommerce_after_add_to_cart_quantity', array( WC_Stripe_Payment_Request::instance(), 'display_payment_request_button_separator_html' ), 2 );
add_action( 'woocommerce_after_add_to_cart_button', array( WC_Stripe_Payment_Request::instance(), 'display_payment_request_button_html' ), 2 );
add_action( 'woocommerce_after_add_to_cart_button', array( WC_Stripe_Payment_Request::instance(), 'display_payment_request_button_separator_html' ), 1 );
@OneStep21
OneStep21 / GET ALL CATEGORIES IN WOOCOMMERCE
Created December 17, 2015 07:54
HOW TO GET ALL CATEGORIES , SUB-CATEGORIES AND PRODUCTS IN WOOCOMMERCE WORDPRESS PLUGIN ( This will list all the top level categories and subcategories under them hierarchically. do not use the inner query if you just want to display the top level categories. Style it as you like. )
<?php
$taxonomy = 'product_cat';
$orderby = 'name';
$show_count = 0; // 1 for yes, 0 for no
$pad_counts = 0; // 1 for yes, 0 for no
$hierarchical = 1; // 1 for yes, 0 for no
$title = '';
$empty = 0;