php plugin for wp | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

php plugin for wp

Hello, I want to create a WordPress plugin that will show the products of another site on my site The price shows the price of the currency I want. The user adds the products to the shopping cart and pays. What kind of coding should I do?

24th Jan 2023, 8:36 PM
saeed
saeed - avatar
2 Answers
+ 2
I was just thinking about this again and technically you could write the scraper/api in any language… As long as you can get access to the database of your Worpress shop. As an example I do something similar with a couple of ecommerce sites. In the UK armed forces we provide BFPO locations (british forces post office). Certain locations are overseas and qualify for tax free purchasing. I have a scraper which runs independantly, scrapes the gov website, parses the html, updates our databases (ecommerce sites) with valid locations. Based on a customers address, they have the tax automatically removed from their order. This was prototyped in Python then recreated in C++. There are modules/libraries available in Python that help get it going quickly (requests, beautifulsoup, urllib, sqlalchemy etc). Anyway my point was you don’t need to understand plugins for Wordpress - you can bypass that altogether and feed your products into the db. There’s also a ton of tutorials, just have a look around on Google 👍✌️
25th Jan 2023, 4:53 PM
DavX
DavX - avatar
+ 1
There’s a few ways to do this, the first would be to create a scraper and the second would be to link in via an api (if provided). If the site is public, it’s perfectly legal to scrape data and you do not need to seek permission. You can use this information privately (analysis etc) however if you are putting it back in the public domain you would need to check the site for any TOS (terms of service) or copyright information. If none listed then it’s fair game. If you have a good understanding of PHP / HTML then its a pretty trivial task…however if you are not then there are lots of prebuilt / commercial systems available off the shelf (one might suit your needs, Google “wordpress product scraping”). I hope this helps 👍
25th Jan 2023, 12:33 PM
DavX
DavX - avatar