Open ~/.bash_profile in your favorite editor and add the following content to the bottom.
# Git branch in prompt.
parse_git_branch() {| <?php | |
| /** | |
| * Only allow one payment plan purchase (Subscription) at a time | |
| */ | |
| add_filter( 'woocommerce_add_to_cart_validation', 'woo_block_sub', 10, 2 ); | |
| function woo_block_sub( $valid, $product_id ) { | |
| // Get the current product | |
| $current_product = wc_get_product( $product_id ); |
| const waitFor = (ms) => new Promise(r => setTimeout(r, ms)) | |
| const asyncForEach = async (array, callback) => { | |
| for (let index = 0; index < array.length; index++) { | |
| await callback(array[index], index, array) | |
| } | |
| } | |
| const start = async () => { | |
| await asyncForEach([1, 2, 3], async (num) => { | |
| await waitFor(50) |
| /* | |
| * woocommerce_subscription_payment_complete action hook | |
| * Triggered when a payment is made on a subscription | |
| * @param $subscription | |
| */ | |
| add_action( 'woocommerce_subscription_payment_complete', 'update_user', 10, 1 ); | |
| function update_user($subscription) { | |
| <?php if (!empty($items)): ?> | |
| <ul> | |
| <?php $current_letter = ''; ?> | |
| <?php foreach ($items as $item) : ?> | |
| <?php $first_letter = mb_substr($item['post_title'], 0, 1, "UTF-8"); ?> | |
| <?php if ($first_letter != $current_letter) : ?><li><?php endif; // group list ?> | |
| <?php if ($first_letter != $current_letter) : ?> | |
| <h2><?php echo $first_letter; ?></h2> | |
| <?php $current_letter = $first_letter; ?> | |
| <?php endif; ?> |
| <template> | |
| <div class="editorjs" ref="htmlelement"></div> | |
| </template> | |
| <script setup> | |
| import EditorJS from '@editorjs/editorjs'; | |
| import EmbedTool from '@editorjs/embed'; | |
| import ListTool from '@editorjs/list'; | |
| import ImageTool from '@editorjs/image'; | |
| import VideoTool from './editorjs/video.js'; | |
| import { onMounted, onUnmounted, ref, watch } from 'vue'; |