Skip to content

Instantly share code, notes, and snippets.

Navigate to web root and run:
```
wp post delete $(wp post list --post_type='shop_order' --post_status=wc-pending --format=ids --force) --force
```
Add to Htaccess:
```
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off
php_value docref_root 0
php_value docref_ext 0```
```php
/**
* Add form fields to Checkout
*/
add_filter('woocommerce_checkout_fields', 'wmco_woocommerce_checkout_fields');
function wmco_woocommerce_checkout_fields($fields){
$new_field['billing_org'] = [
'label' => __('Org no.', 'woocommerce'),
'placeholder' => _x('Org no.', 'placeholder', 'woocommerce'),
'required' => false,
```
// Get Product ID
$product->get_id(); (fixes the error: "Notice: id was called incorrectly. Product properties should not be accessed directly")
// Get Product General Info
$product->get_type();
$product->get_name();
$product->get_slug();
Ensure src attribute of video is empty. Then add something like this:
```
<script>
window.onload = function(){
document.getElementById("vidSrc").src = "mysrc.mp4";
document.getElementById("vid").load();
document.getElementById("vid").play();
};
</script>
```
$args = array(
'post__in' => $ids,
'post_type' => array(
'post',
'featured_item', // Include for its tag archive listing.
),
'numberposts' => -1,
'meta_key' => 'custom_post_date',
'orderby' => 'meta_value',
```
dig mydomain.com
```
Extract from unencrypted PFX
```
openssl pkcs12 -in [file.pfx] -out keys_out.txt
```
Extract from encrypted PFX
```
openssl pkcs12 -in [file.pfx] -out keys.pem -nodes
```
WP cron hooks are stored in the options table in an option named cron. WooCommerce likes to fill this over time until it is too big to write.
While not perhaps optimal, what I do is just empty it:
```
UPDATE wp_2_options SET option_value = '' WHERE option_name = 'cron'
```
## Working locally
https://www.shopify.com/partners/blog/95401862-3-simple-steps-for-setting-up-a-local-shopify-theme-development-environment
## Basics
### Conditional
```
{% if user.name == 'elvis' %}
Hey Elvis
{% endif %}