Author Archives: admin

Redirect to previous page after login

  1. Save URL referer in login page

2. Check saved URI after login successfully and redirect

Convert youtube URL to embed code

Reference:

  1. https://stackoverflow.com/questions/22544625/javascript-convert-youtube-vimeo-urls-into-embed-versions-for-use-on-a-forum

Woocommerce thank you page

Variable $order in thankyou.php will be created by order key from URL. e.g. key=wc_order_593a3d1583f2e

So, it’s important to make sure return URLs of payment gateways include this param or thank you page won’t display order info and purchase event of Facebook pixel will not work neither.

Reference:

  1. How to get order key:
    https://stackoverflow.com/questions/37669956/woocommerce-get-order-key

Create Virtual host on EC2 (ubuntu)

Steps

  1. sudo mkdir -p /var/www/rex.com/
  2. sudo chown -R ubuntu:www-data /var/www/rex.com/
  3. sudo chmod -R 755 /var/www/
  4. cd /etc/apache2/sites-available/
    sudo cp 000-default.conf rex.com.conf
    sudo nano rex.com.conf
  5. sudo a2ensite rex.com.conf
  6. sudo service apache2 restart

Reference:

  1. http://diary.taskinghouse.com/posts/664386
  2. https://nouveauframework.org/blog/vhosts-running-multiple-sites-on-a-single-aws-ec2-instance/

Woocommerce Checkout page customization

Reference:

  1. Official Tutorials
    https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/
  2. Sorting for checkout fields
    https://wordpress.stackexchange.com/questions/78339/how-to-reorder-billing-fields-in-woocommerce-checkout-template
  3. Woocommerce Hooks
    https://docs.woocommerce.com/wc-apidocs/hook-docs.html
  4. Other tutorial:
    http://uploadwp.com/customizing-the-woocommerce-checkout-page/

session_start() permission issue

https://serverfault.com/questions/558641/aws-ec2-php-session-start-with-permission-denied

This is because the “Local value” overwrite “Master value” and point to a folder that users don’t have permission to write session related files.

  1. Change session.save_path value or uncomment the line in php.ini
  2. Find and edit the config file
    /etc/httpd/conf.d/php.conf
  3. Restart apache